docfile.php

Summary
docfile.php
DocFileUtility for finding and parsing documentation files
DocFileUtility for finding and parsing documentation files
__constructClass constructor.
forTitleLook up the documentation file by a title in the given paths.
toHTMLParse the markup in a docfile to HTML equivalents.
defaultPathsReturns an array containing the possible paths for the in-UI documentation sources
mailPathsAs defaultPaths but for mail sources (template for invites, etc)
negotiateLanguageFigure out what language code we’re using for a docfile

DocFile

Utility for finding and parsing documentation files

postActiv

the micro-blogging software

Copyright

Copyright © 2016-2017, Maiyannah Bishop

Derived from code copyright various sources

  • GNU Social © 2013-2016, Free Software Foundation, Inc
  • StatusNet © 2008-2012, StatusNet, Inc

License

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program.  If not, see http://www.gnu.org/licenses/.

https://www.gnu.org/licenses/agpl.html

About

Utility for finding and parsing documentation files

PHP version

Tested with PHP 5.6, PHP 7

File Authors

Web

DocFile

Utility for finding and parsing documentation files

Variables

  • protected $filename
  • protected $contents
Summary
__constructClass constructor.
forTitleLook up the documentation file by a title in the given paths.
toHTMLParse the markup in a docfile to HTML equivalents.
defaultPathsReturns an array containing the possible paths for the in-UI documentation sources
mailPathsAs defaultPaths but for mail sources (template for invites, etc)
negotiateLanguageFigure out what language code we’re using for a docfile

__construct

function __construct($filename)

Class constructor.  Sets up the filename protected variable.

forTitle

static function forTitle($title,
$paths)

Look up the documentation file by a title in the given paths.  Spins off the StartDocForTitle and EndDocForTitle events before and after the lookup, but importantly, both are before any returns, for obvious control path reasons.

Parameters

  • string title - filename of the docfile to look up
  • array paths - paths to look in

Returns

  • DocFile of that file if it finds a file, null if there is no file found.

toHTML

function toHTML($args = null)

Parse the markup in a docfile to HTML equivalents.

defaultPaths

static function defaultPaths()

Returns an array containing the possible paths for the in-UI documentation sources

mailPaths

static function mailPaths()

As defaultPaths but for mail sources (template for invites, etc)

negotiateLanguage

static function negotiateLanguage($filenames,  
$defaultFilename = null)

Figure out what language code we’re using for a docfile

Parameters

  • filenames - files we’re looking up the language for
  • defaultFilename - default filename to use if we don’t find something, defaults to null

Returns

  • string filename or null if not found

Todo

  • Do this better
function __construct($filename)
Class constructor.
static function forTitle($title,
$paths)
Look up the documentation file by a title in the given paths.
function toHTML($args = null)
Parse the markup in a docfile to HTML equivalents.
static function defaultPaths()
Returns an array containing the possible paths for the in-UI documentation sources
static function mailPaths()
As defaultPaths but for mail sources (template for invites, etc)
static function negotiateLanguage($filenames,  
$defaultFilename = null)
Figure out what language code we’re using for a docfile