Najax 0.4.0.0 > Classes / Meta.class.php

Questions? Need Help? Want to share? » PHP Forum
Script Name:
Najax 0.4.0.0

Download:
najax-0.4.0.0.zip

Category:
Web Fetching

Archive Content:

Najax 0.4.0.0

Najax 0.4.0.0 > Classes

Najax 0.4.0.0 > Classes > Events > Storage

Najax 0.4.0.0 > Classes > Events

Najax 0.4.0.0 > Classes

Najax 0.4.0.0 > Config

Najax 0.4.0.0 > Docs > Source

Najax 0.4.0.0 > Docs > Source > Media

Najax 0.4.0.0 > Docs > Source > Media > Images

Najax 0.4.0.0 > Docs > Source > Media > Lib

Najax 0.4.0.0 > Docs > Source > Media

Najax 0.4.0.0 > Docs > Source > NAJAX > NACLES

Najax 0.4.0.0 > Docs > Source > NAJAX

Najax 0.4.0.0 > Docs > Source > NAJAX > NAJAX HTML

Najax 0.4.0.0 > Docs > Source > NAJAX

Najax 0.4.0.0 > Docs > Source

Najax 0.4.0.0 > Docs > Source > Filesource

Najax 0.4.0.0 > Docs > Tutorials

Najax 0.4.0.0 > Examples > Basic

Najax 0.4.0.0 > Examples > Chat

Najax 0.4.0.0 > Examples > Chat > Images

Najax 0.4.0.0 > Examples > Chat

Najax 0.4.0.0 > Examples > Chat > Var

Najax 0.4.0.0 > Examples > ChatAdvanced

Najax 0.4.0.0 > Examples > ChatAdvanced > Images > Default

Najax 0.4.0.0 > Examples > ChatAdvanced

Najax 0.4.0.0 > Examples > ChatAdvanced > Smilies

Najax 0.4.0.0 > Examples > ChatAdvanced > Style

Najax 0.4.0.0 > Examples > Events

Najax 0.4.0.0 > Examples > Exam

Najax 0.4.0.0 > Examples > Explorer

Najax 0.4.0.0 > Examples > Explorer > Images

Najax 0.4.0.0 > Examples > Explorer

Najax 0.4.0.0 > Examples > Explorer > Style

Najax 0.4.0.0 > Examples > Html > Content

Najax 0.4.0.0 > Examples > Html

Najax 0.4.0.0 > Extensions > Html > Classes > DOM

Najax 0.4.0.0 > Extensions > Html > Classes

Najax 0.4.0.0 > Extensions > Html

Najax 0.4.0.0 > Extensions > Html > Js

Najax 0.4.0.0

Najax 0.4.0.0 > Js

Najax 0.4.0.0

Meta.class.php:


<?php
/**
 * NAJAX Meta Namespace file.
 *
 * <p>This file defines the {@link NAJAX_Meta} Class.</p>
 * <p>This class is used internally only.</p>
 *
 * @author    Stanimir Angeloff
 *
 * @package    NAJAX
 *
 * @version    0.4.0.0
 *
 */

/**
 * NAJAX Meta Class.
 *
 * <p>This class is used to extend classes with meta
 * data,  such as private methods and/or variables.</p>
 * <p>You should never use this class directly.
 * Rather,  use the {@link NAJAX_Utilities} class.</p>
 *
 * @access        private
 *
 * @author        Stanimir Angeloff
 *
 * @package        NAJAX
 *
 * @version        0.4.0.0
 *
 */
class NAJAX_Meta extends NAJAX_Observable
{
    
/**
     *
     * @access    private
     *
     * @var        array
     *
     */
    
var $publicMethods;

    
/**
     *
     * @access    private
     *
     * @var        array
     *
     */
    
var $privateMethods;

    
/**
     *
     * @access    private
     *
     * @var        array
     *
     */
    
var $publicVariables;

    
/**
     *
     * @access    private
     *
     * @var        array
     *
     */
    
var $privateVariables;

    
/**
     *
     * @access    private
     *
     * @var        array
     *
     */
    
var $methodsMap;

    
/**
     *
     * @access    public
     *
     * @return    void
     *
     */
    
function setPublicMethods($methods)
    {
        
$methodsType NAJAX_Utilities::getType($methods);

        if (
$methodsType == 'string') {

            
$this->publicMethods = array(NAJAX_Utilities::caseConvert($methods));

        } else if ((
$methodsType == 's_array') || ($methodsType == 'a_array')) {

            
$this->publicMethods array_map(array('NAJAX_Utilities',  'caseConvert'),  $methods);

        } else {

            
$this->publicMethods null;
        }
    }

    
/**
     *
     * @access    public
     *
     * @return    void
     *
     */
    
function setPrivateMethods($methods)
    {
        
$methodsType NAJAX_Utilities::getType($methods);

        if (
$methodsType == 'string') {

            
$this->privateMethods = array(NAJAX_Utilities::caseConvert($methods));

        } else if ((
$methodsType == 's_array') || ($methodsType == 'a_array')) {

            
$this->privateMethods array_map(array('NAJAX_Utilities',  'caseConvert'),  $methods);

        } else {

            
$this->privateMethods null;
        }
    }

    
/**
     *
     * @access    public
     *
     * @return    void
     *
     */
    
function setPublicVariables($variables)
    {
        
$variablesType NAJAX_Utilities::getType($variables);

        if (
$variablesType == 'string') {

            
$this->publicVariables = array(NAJAX_Utilities::caseConvert($variables));

        } else if ((
$variablesType == 's_array') || ($variablesType == 'a_array')) {

            
$this->publicVariables array_map(array('NAJAX_Utilities',  'caseConvert'),  $variables);

        } else {

            
$this->publicVariables null;
        }
    }

    
/**
     *
     * @access    public
     *
     * @return    void
     *
     */
    
function setPrivateVariables($variables)
    {
        
$variablesType NAJAX_Utilities::getType($variables);

        if (
$variablesType == 'string') {

            
$this->privateVariables = array(NAJAX_Utilities::caseConvert($variables));

        } else if ((
$variablesType == 's_array') || ($variablesType == 'a_array')) {

            
$this->privateVariables array_map(array('NAJAX_Utilities',  'caseConvert'),  $variables);

        } else {

            
$this->privateVariables null;
        }
    }

    
/**
     *
     * @access    public
     *
     * @return    void
     *
     */
    
function setMethodsMap($methodsMap)
    {
        
$methodsMapType NAJAX_Utilities::getType($methodsMap);

        if (
$methodsMapType == 'string') {

            
$this->methodsMap = array(NAJAX_Utilities::caseConvert($methodsMap) => $methodsMap);

        } else if ((
$methodsMapType == 's_array') || ($methodsMapType == 'a_array')) {

            
$map = array();

            foreach (
$methodsMap as $method) {

                
$map[NAJAX_Utilities::caseConvert($method)] = $method;
            }

            
$this->methodsMap $map;

        } else {

            
$this->methodsMap null;
        }
    }

    
/**
     *
     * @access    public
     *
     * @return    bool
     *
     */
    
function isPublicMethod($methodName)
    {
        if ( ! empty(
$this->privateMethods)) {

            if (
in_array(NAJAX_Utilities::caseConvert($methodName),  $this->privateMethods)) {

                return 
false;
            }
        }

        if ( ! empty(
$this->publicMethods)) {

            if ( ! 
in_array(NAJAX_Utilities::caseConvert($methodName),  $this->publicMethods)) {

                return 
false;
            }
        }

        return 
true;
    }

    
/**
     *
     * @access    public
     *
     * @return    bool
     *
     */
    
function isPublicVariable($variableName)
    {
        if ( ! empty(
$this->privateVariables)) {

            if (
in_array(NAJAX_Utilities::caseConvert($variableName),  $this->privateVariables)) {

                return 
false;
            }
        }

        if ( ! empty(
$this->publicVariables)) {

            if ( ! 
in_array(NAJAX_Utilities::caseConvert($variableName),  $this->publicVariables)) {

                return 
false;
            }
        }

        return 
true;
    }

    
/**
     *
     * @access    public
     *
     * @return    string
     *
     */
    
function findMethodName($methodName)
    {
        if ( ! empty(
$this->methodsMap)) {

            
$name NAJAX_Utilities::caseConvert($methodName);

            if (isset(
$this->methodsMap[$name])) {

                return 
$this->methodsMap[$name];
            }
        }

        return 
$methodName;
    }

    
/**
     * Adds a {@link NAJAX_Meta} events observer.
     *
     * @access    public
     *
     * @param    mixed    $observer    The observer object to add (must extend {@link NAJAX_Observer}).
     *
     * @return    string    true on success,  false otherwise.
     *
     * @static
     *
     */
    
function addObserver(&$observer)
    {
        return 
parent::addObserver($observer,  'NAJAX_Meta');
    }

    
/**
     *
     * @access    private
     *
     * @return    bool
     *
     */
    
function notifyObservers($event 'default',  $arg null)
    {
        return 
parent::notifyObservers($event,  $arg,  'NAJAX_Meta');
    }
}
?>


Other Web Fetching Scripts:

WebMaster Resources Home

©RingsWorld.com