include/SugarFields/Parsers/QuickCreateMetaParser.php

Show: inherited
Table of Contents

\QuickCreateMetaParser

Package:

MetaParser.php

This is a utility base file to parse HTML

Parent(s)
\MetaParser
Author
Collin Lee  

Properties

Propertypublic  $mCustomPanels= ''
inheritedInherited from: \MetaParser::$$mCustomPanels
Details
Type
n/a
Inherited_from
\MetaParser::$$mCustomPanels  
Propertypublic  $mModule= ''
inheritedInherited from: \MetaParser::$$mModule
Details
Type
n/a
Inherited_from
\MetaParser::$$mModule  
Propertypublic  $mPHPFile= ''
inheritedInherited from: \MetaParser::$$mPHPFile
Details
Type
n/a
Inherited_from
\MetaParser::$$mPHPFile  
Propertypublic  $mView= ''
inheritedInherited from: \MetaParser::$$mView
Details
Type
n/a
Inherited_from
\MetaParser::$$mView  

Methods

methodpublicMetaParser( ) : void
inherited

Inherited from: \MetaParser::MetaParser()
methodpublicQuickCreateMetaParser( ) : void

methodpublicapplyPostRules(  $moduleDir,  $panels ) : void
inherited

Inherited from: \MetaParser::applyPostRules()
Parameters
Name Type Description
$moduleDir
$panels
methodpublicapplyPreRules(  $moduleDir,  $panels ) : void
inherited

Inherited from: \MetaParser::applyPreRules()
Parameters
Name Type Description
$moduleDir
$panels
methodpublicapplyRules(  $moduleDir,  $panels ) : void
inherited

Inherited from: \MetaParser::applyRules()
Parameters
Name Type Description
$moduleDir
$panels
methodpublicconvertToTagElement(  $matches ) : void
inherited

Inherited from: \MetaParser::convertToTagElement()
Parameters
Name Type Description
$matches
methodpubliccreateFileContents(  $moduleDir,  $panels,  $templateMeta = array(),  $htmlFilePath ) : void
inherited

Inherited from: \MetaParser::createFileContents()
Parameters
Name Type Description
$moduleDir
$panels
$templateMeta
$htmlFilePath
methodpublicdirList( \$directory $directory ) : \$results
inherited

dirList Utility method to list all the files in a given directory.

Inherited from: \MetaParser::dirList()
Parameters
Name Type Description
$directory \$directory

The directory to scan

Returns
Type Description
\$results The files in the directory that were found
methodpublicfindAssignedVariableName( \$name $name, \$filePath $filePath ) : \The
inherited

findAssignedVariableName This method provides additional support in attempting to parse the module's corresponding PHP file for either the EditView or DetailView. In the event that the subclasses cannot find a matching vardefs.php entry in the HTML file, this method can be called to parse the PHP file to see if the assignment was made using the bean's variable. If so, we return this variable name.

Inherited from: \MetaParser::findAssignedVariableName()
Parameters
Name Type Description
$name \$name

The tag name found in the HTML file for which we want to search

$filePath \$filePath

The full file path for the HTML file

Returns
Type Description
\The variable name found in PHP file, original $name variable if not found
methodpublicfindSingleVardefElement(  $formElements = array(),  $vardefs = array() ) : void
inherited

findSingleVardefElement Scans array of form elements to see if just one is a vardef element and, if so, return that vardef name

Inherited from: \MetaParser::findSingleVardefElement()
Parameters
Name Type Description
$formElements
$vardefs
methodpublicfixDuplicateTrTags(  $tableContents ) : void
inherited

fixDuplicateTrTags This is a very crude function to fix instances where files have two consecutive tags

Inherited from: \MetaParser::fixDuplicateTrTags()
Parameters
Name Type Description
$tableContents
methodpublicfixRowsWithMissingTr(  $tableContents ) : void
inherited

fixRowsWithMissingTr This is a very crude function to fix instances where files have an tag immediately followed by a tag

Inherited from: \MetaParser::fixRowsWithMissingTr()
Parameters
Name Type Description
$tableContents
methodpublicfixTablesWithMissingTr(  $tableContents ) : void
inherited

fixTablesWithMissingTr This is a very crude function to fix instances where files declared a table as instead of . Without this helper function, the parsing could messed up.

Inherited from: \MetaParser::fixTablesWithMissingTr()
Parameters
Name Type Description
$tableContents
methodpublicgetCustomField( \$elementNames $elementNames ) : String
inherited

isCustomField This method checks the mixed variable $elementNames to see if it is a custom field. A custom field is simply defined as a field that ends with "_c". If $elementNames is an Array any matching custom field value will result in a true evaluation

Inherited from: \MetaParser::getCustomField()
Parameters
Name Type Description
$elementNames \$elementNames

Array or String value of form element name(s).

Returns
Type Description
String name of custom field; null if none found
methodpublicgetCustomPanels( ) : void
inherited

Inherited from: \MetaParser::getCustomPanels()
methodpublicgetElementValue(  $type,  $contents,  $filter = "(.*?)" ) : void
inherited

getElementValue

Inherited from: \MetaParser::getElementValue()
Parameters
Name Type Description
$type
$contents
$filter
methodpublicgetElementsByType( \$type $type,  $contents ) : \a
inherited

getElementsByType

Inherited from: \MetaParser::getElementsByType()

Returns an Array of all elements matching type. It will match for the outermost tags. For example given contents: "Text

a

" and method call getElementsByType("", $contents) returns "Text

a

"

Parameters
Name Type Description
$type \$type

The type of element to parse out and return

$contents
Returns
Type Description
\a tag element format Array
methodpublicgetFormContents(  $contents,  $all = true ) : void
inherited

getFormContents Parses for contents enclosed within

...
tags

Inherited from: \MetaParser::getFormContents()
Parameters
Name Type Description
$contents
$all
methodpublicgetFormElements( \$contents $contents ) : \$matches
inherited

getFormElements Parses for input, select, textarea types from string content

Inherited from: \MetaParser::getFormElements()
Parameters
Name Type Description
$contents \$contents

The String contents to parse

Returns
Type Description
\$matches Array of matches of PREG_SET_ORDER
methodpublicgetFormElementsNames( \$contents $contents ) : \$matches
inherited

getFormElementsNames Parses for the name values of input, select, textarea types from string content

Inherited from: \MetaParser::getFormElementsNames()
Parameters
Name Type Description
$contents \$contents

The String contents to parse

Returns
Type Description
\$matches Array of name/value pairs
methodpublicgetJavascript( \$contents $contents,  $addLiterals = true ) : \$javascript
inherited

getJavascript

Inherited from: \MetaParser::getJavascript()

This method parses the given $contents String and grabs all <script...>... blocks. The method also converts values enclosed within "{...}" blocks that may need to be converted to Smarty syntax.

Parameters
Name Type Description
$contents \$contents

The HTML String contents to parse

$addLiterals
Returns
Type Description
\$javascript The formatted script blocks or null if none found
methodpublicgetMaxColumns( \$contents $contents, \$filter $filter ) : \The
inherited

getMaxColumns Returns the highest number of ... blocks within a ... block.

Inherited from: \MetaParser::getMaxColumns()
Parameters
Name Type Description
$contents \$contents

The table contents to parse

$filter \$filter

Optional filter to parse for an attribute within the td block.

Returns
Type Description
\The maximum column count
methodpublicgetRelateFieldName(  $mixed = '' ) : void
inherited

Inherited from: \MetaParser::getRelateFieldName()
Parameters
Name Type Description
$mixed
methodpublicgetTables( \$tableClass $tableClass = null,  $contents ) : Array
inherited

getTables Returns an Array of the tables found in the file. If $tableClass parameter is supplied, it'll return only those tables that have a matching class attribute equal to $tableClass

Inherited from: \MetaParser::getTables()
Parameters
Name Type Description
$tableClass \$tableClass

Optional table class parameter value

$contents
Returns
Type Description
Array of table elements found
methodpublicgetTagAttribute( \$name $name, \$contents $contents, \$filter $filter = '' ) : Array
inherited

getTagAttribute Returns the name/value of a tag attribute where name is set to $name

Inherited from: \MetaParser::getTagAttribute()
Parameters
Name Type Description
$name \$name

The name of the attribute

$contents \$contents

The contents to parse

$filter \$filter

Option regular expression to filter value

Returns
Type Description
Array of name/value for matching attribute
methodpublichasMultiplePanels(  $panels ) : void
inherited

Inherited from: \MetaParser::hasMultiplePanels()
Parameters
Name Type Description
$panels
methodpublichasRequiredSpanLabel(  $html ) : void
inherited

Inherited from: \MetaParser::hasRequiredSpanLabel()
Parameters
Name Type Description
$html
methodpublicmergePanels( \$panels $panels, \$moduleDir $vardefs, \$masterCopy $moduleDir,  $masterCopy ) : Array
inherited

mergePanels This function merges the $panels Array against the $masterCopy's meta data definition

Inherited from: \MetaParser::mergePanels()
Parameters
Name Type Description
$panels \$panels

meta data Array to merge

$vardefs \$moduleDir

Directory name of the module

$moduleDir \$masterCopy

file path to the meta data master copy

$masterCopy
Returns
Type Description
Array of merged $panel definition
methodpublicmergeTemplateMeta( \$templateMeta $templateMeta, \$moduleDir $moduleDir, \$masterCopy $masterCopy ) : Array
inherited

mergeTemplateMeta This function merges the $templateMeta Array against the $masterCopy's meta data definition

Inherited from: \MetaParser::mergeTemplateMeta()
Parameters
Name Type Description
$templateMeta \$templateMeta

meta data Array to merge

$moduleDir \$moduleDir

Directory name of the module

$masterCopy \$masterCopy

file path to the meta data master copy

Returns
Type Description
Array of merged $templateMeta definition
methodpublicparse( \$filePath $filePath, \$vardefs $vardefs = array(), \$moduleDir $moduleDir = '', \$merge $merge = false, \$masterCopy $masterCopy = null ) : String

parse

Parameters
Name Type Description
$filePath \$filePath

The file path of the HTML file to parse

$vardefs \$vardefs

The module's vardefs

$moduleDir \$moduleDir

The module's directory

$merge \$merge

boolean value indicating whether or not to merge the parsed contents

$masterCopy \$masterCopy

The file path of the mater copy of the metadata file to merge against

Returns
Type Description
String format of metadata contents
methodpublicparseDelimiters(  $javascript ) : void
inherited

Inherited from: \MetaParser::parseDelimiters()
Parameters
Name Type Description
$javascript
methodpublicstripComments(  $contents ) : void
inherited

Inherited from: \MetaParser::stripComments()
Parameters
Name Type Description
$contents
methodpublicstripFlavorTags( \$contents $contents ) : void
inherited

stripFlavorTags This method accepts the file contents and uses the $GLOBALS['sugar_flavor'] value to remove the flavor tags in the file contents if present. If $GLOBALS['sugar_flavor'] is not set, it defaults to PRO flavor

Inherited from: \MetaParser::stripFlavorTags()
Parameters
Name Type Description
$contents \$contents

The file contents as a String value

methodpublictrimHTML(  $contents ) : void
inherited

Inherited from: \MetaParser::trimHTML()
Parameters
Name Type Description
$contents
Documentation was generated by DocBlox 0.18.1.