ultimix

- Main Page
- Data Structures
- Files
- Examples

- Data Structures
- Data Structure Index
- Data Fields

Public Member Functions | Data Fields
page_js_1_0_0 Class Reference

## Public Member Functions
| __construct ()
| join_scripts ($Files)
| compile_scripts (&$Settings)
| add_javascript ($Path, $Join=true)

## Data Fields
| $JSFiles = array()
| $Cache = false
| $CachedMultyFS = false
| $PageComposer = false
| $Security = false
| $String = false
| $Tags = false
| $Trace = false

## Detailed Description

Page composer utilities.

Author
  Dodonov A.A.

Definition at line 26 of file page_js.php.

## Constructor & Destructor Documentation

__construct | ( |  | ) |

Constructor.

Author
  Dodonov A.A.

Definition at line 68 of file page_js.php.

{
try
{
$this->Cache = get_package( 'cache' , 'last' , __FILE__ );
$this->CachedMultyFS = get_package( 'cached_multy_fs' , 'last' , __FILE__ );
$this->Security = get_package( 'security' , 'last' , __FILE__ );
$this->String = get_package( 'string' , 'last' , __FILE__ );
$this->Tags = get_package( 'string::tags' , 'last' , __FILE__ );
$this->Trace = get_package( 'trace' , 'last' , __FILE__ );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

## Member Function Documentation

add_javascript | ( |  | $Path,
|  |  | $Join = `true`
| ) |  |

Function adds javascript to include queue.

Parameters

  $Path | - Path to the script.
  $Join | - Should this script be joined with others.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 402 of file page_js.php.

{
try
{
if( $this->PageComposer === false )
{
$this->PageComposer = get_package( 'page::page_composer' , 'last' , __FILE__ );
}
$Path = $this->PageComposer->Template->compile_string( $Path );
foreach( $this->JSFiles as $k => $v )
{
if( $v[ 'path' ] == $Path )
{
return;
}
}
$this->JSFiles [] = array( 'path' => $Path , 'join' => $Join );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

compile_scripts | ( | & | $Settings | ) |

Function outputs scripts.

Parameters

  $Settings | - Settings.

Returns
  Scripts.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 359 of file page_js.php.

{
try
{
$Content = '';
if( is_array( $this->JSFiles ) && count( $this->JSFiles ) )
{
$Content = $this->get_scripts_content();
}
$this->JSFiles = array();
return( $Content );
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

join_scripts | ( |  | $Files | ) |

Function unites scripts.

Parameters

  $Files | - Array of files to unite.

Returns
  Array of files after the union.

Exceptions

  Exception | An exception of this type is thrown.

Author
  Dodonov A.A.

Definition at line 260 of file page_js.php.

{
try
{
if( is_array( $Files ) && count( $Files ) > 0 )
{
$RetFiles = $this->join_compressed_scripts( $Files );
$FilesHash = md5( implode_ex( '' , $Files , 'path' ) );
$UnionFilePath = dirname( __FILE__ )."/tmp/$FilesHash.js";
$RetFiles [] = array(
'path' => str_replace(
'./' , '{http_host}/' , _get_package_relative_path( __FILE__ )."/tmp/$FilesHash.js"
)
);
return( $RetFiles );
}
else
{
return( $Files );
}
}
catch( Exception $e )
{
$a = func_get_args();_throw_exception_object( __METHOD__ , $a , $e );
}
}

## Field Documentation

$Cache = false

Cached object.

Author
  Dodonov A.A.

Definition at line 50 of file page_js.php.

$CachedMultyFS = false

Definition at line 51 of file page_js.php.

$JSFiles = array()

Array keeps all file paths to be included.

Author
  Dodonov A.A.

Definition at line 38 of file page_js.php.

$PageComposer = false

Definition at line 52 of file page_js.php.

$Security = false

Definition at line 53 of file page_js.php.

$String = false

Definition at line 54 of file page_js.php.

$Tags = false

Definition at line 55 of file page_js.php.

$Trace = false

Definition at line 56 of file page_js.php.

The documentation for this class was generated from the following file:

- packages/page/packages/page_js/page_js.php