Gets the placeholder replacement text
@param string $placeholder The placeholder
@return string Returns the replacement, without parameters attached, yet
503896
public function GetReplacement($placeholder)
    {
        if (isset($this->texts[$placeholder]))
        {
            return $this->texts[$placeholder];
        }
        return $this->phpTranslator->GetReplacement($placeholder);
    }
500475
protected function placeholderClb($matches)
    {
        $placeholder = isset($matches[1]) ? $matches[1] : '';
        if (isset($matches[3])) {
            $name = $matches[3];
            if (empty($name)) {
                /* There is a named placeholder without name ("?set:") */
                throw new UnknownPlaceholder($matches[0]);
            }
        } else {
            $name = null;
            if ($placeholder == '?') { // "??" for question mark
                return '?';
            }
        }
        if ($name) {
            if ($this->counter == 0) {
                $this->named = true;
            } elseif (!$this->named) {
                /* There is a named placeholder although already used regular */
                throw new MixedPlaceholder($matches[0]);
            }
            if (!array_key_exists($name, $this->data)) {
                throw new DataNamed($name);
            }
            $value = $this->data[$name];
        } elseif ($this->named) {
            /* There is a regular placeholder although already used named */
            throw new MixedPlaceholder($matches[0]);
        } else {
            if (!array_key_exists($this->counter, $this->data)) {
                /* Data for regular placeholders is ended */
                throw new DataNotEnough(count($this->data), $this->counter);
            }
            $value = $this->data[$this->counter];
        }
        $this->counter++;
        $parser = new ParserPH($placeholder);
        $type = $parser->getType();
        $modifiers = $parser->getModifiers();
        $method = 'replacement'.strtoupper($type);
        return $this->$method($value, $modifiers);
    }
1329482
public function getWhereString($usePlaceholders = true, $includeText = true)
    {
        $statement = $this->getCriteriaString($this->where, $usePlaceholders, $this->wherePlaceholderValues);

        if ($includeText && $statement) {
            $statement = "WHERE " . $statement;
        }

        return $statement;
    }
804245
public static function replaceStringPlaceholders($text, $deletePlaceholders = false)
    {
        if (is_string($text)) {
            // Fast pre-check, to optimize performance
            if (strpos($text, "_") !== false) {
                $replaceStringPlaceholders = function ($matches) use ($deletePlaceholders) {
                    $result = "";
                    if (isset(self::$replacements[$matches[1]])) {
                        $result = self::$replacements[$matches[1]];
                        $result = str_replace(
                            ['_STRING_CSSLINEBREAK_', '_STRING_ESCAPEDDOUBLEQUOTE_', '_STRING_ESCAPEDSINGLEQUOTE_'],
                            ["\\\n", '\\"', "\\'"],
                            $result
                        );
                        if ($deletePlaceholders === true) {
                            unset(self::$replacements[$matches[1]]);
                        }
                    }
                    return $result;
                };
                $text = preg_replace_callback('/(?:_STRING_([a-f0-9]{32})_)/', $replaceStringPlaceholders, $text);
            }
            return $text;
        } else {
            throw new \InvalidArgumentException(
                "Invalid type '" . gettype($text). "' for argument 'text' given."
            );
        }
    }
848228
private static function getPlaceholders(string $content): array
    {
        $result = [];
        $matchCount = preg_match_all(static::getPlaceholderPattern(), $content, $result);

        if (false !== $matchCount && 0 < $matchCount) {
            foreach ($result as $index => $placeholders) {
                $result[$index] = array_unique($placeholders);
            }
        }

        return $result;
    }
167718
public function replaceByPrefix($value, array $placeholders = [])
    {
        $dataPrefix = $this->getNamePrefix($value);
        if (strtolower($dataPrefix['prefix']) === 'inline') {
            $template = clone $this;
            $result = $template->replace($dataPrefix['value'], $placeholders);

            return $result;
        }
        $result = $this->getChunk(trim($value), $placeholders);

        return $result;
    }
144092
protected function fill($placeholder, $instance){
        switch( $placeholder ){
            case 'title':
                return get_the_title();
                break;
            case 'url':
                return get_permalink();
                break;
            case 'excerpt':
                return  get_the_excerpt();
                break;
            case 'date':
                return  get_the_date();
                break;
            case 'modified':
                return get_the_modified_date();
                break;
            case 'author':
                return get_the_author();
                break;
            default:
                return false;
                break;
        }
    }
925759
private function getDeleteStatement($usePlaceholders = true)
    {
        $statement = "";

        if (!$this->isDelete()) {
            return $statement;
        }

        $statement .= $this->getDeleteString();

        if ($this->from) {
            $statement .= " " . $this->getFromString();
        }

        if ($this->where) {
            $statement .= " " . $this->getWhereString($usePlaceholders);
        }

        // ORDER BY and LIMIT are only applicable when deleting from a single
        // table.
        if ($this->isDeleteTableFrom()) {
            if ($this->orderBy) {
                $statement .= " " . $this->getOrderByString();
            }

            if ($this->limit) {
                $statement .= " " . $this->getLimitString();
            }
        }

        return $statement;
    }
580626
private function extractUsedClasses(&$placeholder)
    {
        $classNamespaceRegExp = '/([\\\\a-zA-Z0-9_]*\\\\[\\\\a-zA-Z0-9_]*)/';
        $matches = [];
        $usedInModelClasses = [];
        if (preg_match_all($classNamespaceRegExp, $placeholder, $matches)) {
            foreach ($matches[1] as $match) {
                $usedClassName = $match;
                $usedInModelClasses[] = trim($usedClassName, '\\');
                $namespaceParts = explode('\\', $usedClassName);
                $resultClassName = array_pop($namespaceParts);
                $placeholder = str_replace($usedClassName, $resultClassName, $placeholder);
            }
        }

        return array_unique($usedInModelClasses);
    }
610261
public function setPlaceHolder(PlaceHolder $placeHolder)
	{
		$this->placeHolder = $placeHolder;
		$this->placeHolder->addBlock($this);
	}
412904
public function _format($format, $placeholders = [], $default = '')
	{
		$placeholders = (array) $placeholders;
		$matches = [];
		if(!preg_match_all('/\{([^{}]*)\}+/u', $format, $matches))
			return sprintf($format, ...array_values($placeholders));

		ksort($placeholders, SORT_NATURAL);
		$placeholders['__default__'] = $default;
		$positions = array_flip(array_keys($placeholders));

		$type_specifiers = '/([sducoxXbgGeEfF])$/u';
		$replacements = [];

		foreach ($matches[1] as $match) {

			list($name, $options) = array_pad(explode(':', $match, 2), 2, '');
			if(!preg_match($type_specifiers, $options))
				$options .= 's';

			$position = array_key_exists($name, $positions)
			? $positions[$name]+1 : $positions['__default__']+1;

			$pattern = '%'.$position.'$'.$options;
			$replacements['{'.$match.'}'] = $pattern;
		}

		$format = str_replace(array_keys($replacements), array_values($replacements), $format);

		return sprintf($format, ...array_values($placeholders));
	}
1346407
public function pushPlaceholder(PlaceholderInterface $placeholder)
    {
        $className = get_class($placeholder);
        
        $this->placeholders->set($className, $placeholder);
        
        return $this;
    }
1133724
private function fetchPlaceholder($placeholder)
    {
        try {
            $image = $this->imageClient->get($placeholder);
        } catch (RequestException $e) {
            // We couldn't fetch the file, fall back to default behaviour
            return false;
        }

        $filename = sprintf('placeholder_%s.jpg', substr(md5(microtime()), 0, 12));

        try {
            $this->filesystem->put('files://' . $filename, $image);
        } catch (IOException $e) {
            // We couldn't save the file, fall back to default behaviour
            return false;
        }

        return $filename;
    }
369937
public static function getPlaceholder($placeholderVar, $prevId, NavItemPage $navItemPage)
    {
        $nav_item_page_block_item_data = NavItemPageBlockItem::find()
            ->where(['prev_id' => $prevId, 'nav_item_page_id' => $navItemPage->id, 'placeholder_var' => $placeholderVar])
            ->orderBy(['sort_index' => SORT_ASC])
            ->with(['block'])
            ->all();
        
        $data = [];
    
        foreach ($nav_item_page_block_item_data as $blockItem) {
            $item = self::getBlockItem($blockItem, $navItemPage);
            if ($item) {
                $data[] = $item;
            }
            
            unset($item);
        }
    
        return $data;
    }
740363
private function replacePlaceHolder($value)
    {
        $value=str_replace(self::OBJECT_CONFIG_BASE_DIR_PLACE_HOLDER, $this->m_config->getBaseDir(), $value);
        $value=str_replace(self::OBJECT_CONFIG_USER_DIR_PLACE_HOLDER, $this->m_config->getUserDir(), $value);
        $value=str_replace(self::OBJECT_CONFIG_CONFIG_DIR_PLACE_HOLDER, $this->m_config->getConfigDir(), $value);
        return $value;
    }
1193736
protected function placeholders(int $count, string $placeholder = '?', bool $surround = true): string {
		$temp = join(", ", array_pad([], $count, $placeholder));
		
		// the above line simply gives us a comma separated string of $count placeholders.
		// by default we want to surround them with parentheses, but sometimes maybe we
		// don't.  the $surround bool will tells us how to proceed.
		
		return $surround ? "($temp)" : $temp;
	}
141519
public function replace(array $placeholders = [])
    {
        if (empty($placeholders)) {
            return $this;
        }
        $callback = function ($value) use ($placeholders) {
            return StringHelper::replace($value, $placeholders, false);
        };
        $this->data = ArrayHelper::map($this->data, $callback, true);
        return $this;
    }