Gets the title for a static page from its slug or path
@param string $slugOrPath Slug or path
@return string
345172
public static function title($slugOrPath)
    {
        //Gets only the filename (without extension)
        $slugOrPath = pathinfo($slugOrPath, PATHINFO_FILENAME);

        //Turns dashes into underscores (because `Inflector::humanize` will
        //  remove only underscores)
        $slugOrPath = str_replace('-', '_', $slugOrPath);

        return Inflector::humanize($slugOrPath);
    }
500116
public function loadRoutesFromPath($fromPath, $namespace = '', $hooks=[])
    {
        $dir = @dir($fromPath) or abort("dir $fromPath not exist");

        $getEach = function () use ($dir) {
            $name = $dir->read();
            if (!$name) {
                return $name;
            }
            return $name;
        };

        while (!!($entry = $getEach())) {
            if ($entry == '.' || $entry == '..') {
                continue;
            }
            $path = $fromPath . '/' . str_replace('\\', '/', $entry);
            if (is_file($path) && substr_compare($entry, '.php', strlen($entry) - 4, 4, true) == 0) {
                $class_name = $namespace . '\\' . substr($entry, 0, strlen($entry) - 4);
                $this->loadRoutesFromClass($class_name, $hooks);
            } else {
                //\Log::debug($path.' ignored');
            }
        }
    }
377242
public static function get($slug)
    {
        $locale = I18n::getLocale();
        $slug = array_filter(explode('/', $slug));
        $cache = sprintf('page_%s_locale_%s', md5(serialize($slug)), $locale);
        $page = Cache::read($cache, 'static_pages');

        if (empty($page)) {
            //Sets the (partial) filename
            $filename = implode(DS, $slug);

            //Sets the filename patterns
            $patterns = [$filename . '-' . $locale];
            if (preg_match('/^(\w+)_\w+$/', $locale, $matches)) {
                $patterns[] = $filename . '-' . $matches[1];
            }
            $patterns[] = $filename;

            //Checks if the page exists in APP
            foreach ($patterns as $pattern) {
                $filename = self::getAppPath() . $pattern . '.ctp';

                if (is_readable($filename)) {
                    $page = DS . 'StaticPages' . DS . $pattern;

                    break;
                }
            }

            //Checks if the page exists in each plugin
            foreach (Plugin::all() as $plugin) {
                foreach ($patterns as $pattern) {
                    $filename = self::getPluginPath($plugin) . $pattern . '.ctp';

                    if (is_readable($filename)) {
                        $page = $plugin . '.' . DS . 'StaticPages' . DS . $pattern;

                        break;
                    }
                }
            }

            Cache::write($cache, $page, 'static_pages');
        }

        return $page;
    }
458114
public function getTitle()
    {
        $title = array();
        $row = $this->getPage();
        if (!$row) {
            return null;
        }
        do {
            if ($row->name != '' && $row->name != 'Home') {
                $title[] = $row->name;
            }
        } while ($row = $row->getParentPage());
        return implode(' - ', $title);
    }
1235213
def get_slug(self, language_code, lang_name):
        
        title = self.get_title(language_code, lang_name)
        assert title != ""

        title = str(title)  # e.g.: evaluate a lazy translation

        slug = slugify(title)
        assert slug != "", "Title %r results in empty slug!" % title
        return slug
1081944
def generate_page_title(self, data_slug):
        """"""
        tag = Tag.objects.filter(slug=data_slug)
        return tag[0].word
128924
protected function getFullPath($contextPath, $targetPath): string
    {
        if ($this->filesystem->isAbsolutePath($targetPath)) {
            return $targetPath;
        }

        return rtrim($contextPath, '/\\').DIRECTORY_SEPARATOR.$targetPath;
    }
149593
public static function generateRelativePath($absolutePath)
    {
        if ($start = strpos($absolutePath, '/pages/')) {
            return substr($absolutePath, $start + 7);
        } elseif ($start = strpos($absolutePath, '/templates/')) {
            return substr($absolutePath, $start + 11);
        }

        return $absolutePath;
    }
194002
public function getPageTitle($siteTitle = null)
    {
        $title = null;
       
        $title = implode(': ',$this->pageTitle);
                  
        if(!empty($siteTitle) && !empty($title)) {
            $title =  $siteTitle . ' | '.$title ;
        } else {
            $title = $siteTitle;
        }
        
        return '<title>'.$title . '</title>';
    }
697129
public static function getParentPath($path)
    {
        if ($path === '/') {
            $parentPath = '';
        } elseif (strrpos($path, '/') === 0) {
            $parentPath = '/';
        } else {
            $parentPath = substr($path, 0, strrpos($path, '/'));
        }

        return $parentPath;
    }
1367980
public function getTitle(): string
    {
        $metadata = $this->getMetadata();

        if (isset($metadata['Title'])) {
            return is_array($metadata['Title']) ? $metadata['Title'][0] ?? '' : $metadata['Title'];
        }

        return parent::getTitle();
    }
1235575
public function getPageTitle()
    {
        if (!$this->parser) {
            return;
        }

        $node = $this->parser->find('title', 0);

        if ($node) {
            return $node->innertext;
        }
    }
1314238
public function title($var = null)
    {
        if ($var !== null) {
            $this->title = $var;
        }
        if (empty($this->title)) {
            $this->title = ucfirst($this->slug());
        }

        return $this->title;
    }
935161
public static function slug( $title, $separator = '-' )
    {
        $title = static::ascii( $title );

        $flip = $separator == '-' ? '_' : '-';

        $title = preg_replace( '![' . preg_quote( $flip ) . ']+!u', $separator, $title );

        $title = preg_replace( '![^' . preg_quote( $separator ) . '\pL\pN\s]+!u', '', mb_strtolower( $title ) );

        $title = preg_replace( '![' . preg_quote( $separator ) . '\s]+!u', $separator, $title );

        return trim( $title, $separator );
    }
573716
public function getParentTitle()
    {
        if ($parent = $this->Parent()) {
            return $parent->Title ?: ($parent->ClassName . ' #' . $parent->ID);
        }
    }
285495
public function getTitle()
    {
        $title = null;

        if (isset($this->parent->title)) {
            $title = $this->parent->title;
        }

        return $title;
    }
176073
public function getFileContent( string$filePath ):string
	{
		return isset($this->fileGetter) ? $this->fileGetter($filePath) : file_get_contents($filePath);
	}