/*

ALL STATIC METHOD BELOW HERE:
=============================
542210
private static String getDaysInMonthBound(int year, int month) {
	    Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
		cal.set(Calendar.YEAR, year);
	    cal.set(Calendar.MONTH, month);
		cal.set(Calendar.DAY_OF_MONTH, 1);
		return new Integer(cal.getActualMaximum(Calendar.DAY_OF_MONTH)).toString();
	}
1329666
public static final function get_static_info() {
        /** Var \core\event\base $event. */
        $event = new static();
        // Set static event data specific for child class.
        $event->init();
        return array(
            'eventname' => $event->data['eventname'],
            'component' => $event->data['component'],
            'target' => $event->data['target'],
            'action' => $event->data['action'],
            'crud' => $event->data['crud'],
            'edulevel' => $event->data['edulevel'],
            'objecttable' => $event->data['objecttable'],
        );
    }
785749
static function init() {

		switch( PHP_SAPI ) {
		// Ideally we want to be runnning as CLI
		case 'cli':
			break;
		// Special conditions to ensure CGI runs as CLI
		case 'cgi':
			// Ensure resource constants are defined
			if( ! defined('STDERR') ){
				define( 'STDERR', fopen('php://stderr', 'w') );
			}
			if( ! defined('STDOUT') ){
				define( 'STDOUT', fopen('php://stdout', 'w') );
			}
			break;
		default:
			echo "Command line only\n";
			exit(1);
		}
		
		// Default error logger function
		PLUG::set_error_logger( array(__CLASS__,'format_logline') );
		
		// parse command line arguments from argv global
		global $argv, $argc;
		// first cli arg is always current script. second arg will be script arg passed to shell wrapper
		for( $i = 1; $i < $argc; $i++ ){
			$arg = $argv[ $i ];
			
			// Each command line argument may take following forms:
			//  1. "Any single argument", no point parsing this unless it follows #2 below
			//  2. "-aBCD", one or more switches, parse into 'a'=>true, 'B'=>true, and so on
			//  3. "-a value", flag used with following value, parsed to 'a'=>'value'
			//  4. "--longoption", GNU style long option, parse into 'longoption'=>true
			//  5. "--longoption=value", as above, but parse into 'longoption'=>'value'
			//  6."any variable name = any value" 
			
			$pair = explode( '=', $arg, 2 );
			if( isset($pair[1]) ){
				$name = trim( $pair[0] );
				if( strpos($name,'--') === 0 ){
					// #5. trimming "--" from option, tough luck if you only used one "-"
					$name = trim( $name, '-' );
				}
				// else is #6, any pair
				$name and self::$args[$name] = trim( $pair[1] );
			}
			
			else if( strpos($arg,'--') === 0 ){
				// #4. long option, no value
				$name = trim( $arg, "-\n\r\t " );
				$name and self::$args[ $name ] = true;
			}
			
			else if( $arg && $arg{0} === '-' ){
				$flags = preg_split('//', trim($arg,"-\n\r\t "), -1, PREG_SPLIT_NO_EMPTY );
				foreach( $flags as $flag ){
					self::$args[ $flag ] = true;
				}
				// leave $flag set incase a value follows.
				continue;
			}

			// else is a standard argument. use as value only if it follows a flag, e.g "-a apple"
			else if( isset($flag) ){
				self::$args[ $flag ] = trim( $arg );
			}

			// dispose of last flag
			unset( $flag );
			// next arg 
		}
	}
89502
function outputAll(cb) {
    cb = u.maybe(cb);

    var count = u.size(self.file$);
    var result = [];

    if (!defaultOutput || !count) return cb(log('statics.outputAll: no output'));

    var done = u.after(count, function() {
      log('output %s %s static files', defaultOutput.path, result.length);
      cb(result);
    });

    var omit = defaultOutput.omitRoutes;
    if (omit && !u.isArray(omit)) { omit = [omit]; }

    // TODO: re-use similar filter in generator.output and serve-scripts.outputAll
    var filterRe = new RegExp('^(/admin/|/server/' +
                (opts.editor ? '' : '|/pub/') +
                       (omit ? '|' + u.map(omit, u.escapeRegExp).join('|') : '') +
                              ')');

    u.each(self.file$, function(spo, reqPath) {
      if (filterRe.test(reqPath)) return done();

      var src = path.join(spo.sp.src.path, spo.file);
      var dest = path.join(defaultOutput.path, spo.sp.route, spo.file);

      // copy will create dirs if necessary
      fs.copy(src, dest, function(err) {
        if (err) return done(log(err));
        result.push(dest);
        done();
      });

    });
    return self; // chainable
  }
808301
protected static function initialize()
    {
        $class = static::class;

        if (static::$constants === null) {
            static::$constants = (new \ReflectionClass($class))->getConstants();

            foreach (static::names() as $name) {
                static::$lcKeyMap[strtolower($name)] = $name;
            }
        }
    }
170906
function () {
          if (this === global || !exists(this)) {
            throw new TypeError('this is null or not defined for ' + method)
          }
          var args = Array.prototype.slice.call(arguments)
          args.unshift(this) // sets first arg as object instance
          return method.apply(this, args)
        }
637714
function(proto, recurring, statics) {
		Array.forEach(arguments, function(mixins, i) {
			if (mixins) {
				gui.Object.each(mixins, function(name, value) {
					if (i === 0) {
						// TODO: something more elaborate (like defineProperty)
						this.prototype[name] = value;
					} else { // TODO: only at index 1 right?
						gui.Class.descendantsAndSelf(this, function(C) {
							C.$recurring[name] = value;
							C[name] = value;
						});
					}
				}, this);
			}
		}, this);
		return this;
	}
505741
function self_method(data, methods) {
            if (!data) {
                return data;
            }

            var i, ii, prop;

            if (data.constructor === ({}).constructor) {
                for (prop in data) {
                    if (_.isUndefined(data[prop])) {
                        delete data[prop];
                        continue;
                    }

                    data[prop] = self_method(data[prop], methods);
                }
            }
            else if (_.isArray(data)) {
                for (i = 0, ii = data.length; i < ii; ++i) {
                    if (_.isUndefined(data[i])) {
                        --i; --ii;
                        continue;
                    }

                    data[i] = self_method(data[i], methods);
                }
            }
            else {

                methods = _.extend({}, methods, { __getData: null });

                _.each(methods, function(params, method) {

                    if (!_.isFunction(data[method])) {
                        return;
                    }

                    if (_.isNull(params) || _.isUndefined(params)) {
                        params = [];
                    }
                    if (!_.isArray(params)) {
                        params = [params];
                    }

                    data = data[method].apply(data, params);
                });
            }

            return data;
        }
1241410
public static function staticConstructor()
    {
        self::$_RU_ALPHABET = array();
        self::$_EN_ALPHABET = array();

        foreach (self::$_TRANSLATION_TABLE as $pair) {
            self::$_RU_ALPHABET[] = $pair[0];
            self::$_EN_ALPHABET[] = $pair[1];
        }
    }
17750
static function InitStaticVars()
	{

		self::$HTML_ENTITIES_TABLE = array();
		foreach (get_html_translation_table(HTML_ENTITIES, ENT_QUOTES) as $char => $entity)
		{
			self::$HTML_ENTITIES_TABLE[$entity] = '&#' . ord($char) . ';';
		}

		self::$SMART_QUOTE_CHARS =
			array(
				"�" => "'",
				"�" => "'",
				"�" => "\"",
				"�" => "\"",
				chr(145) => "'",
				chr(146) => "'",
				chr(147) => "\"",
				chr(148) => "\"",
				chr(151) => "-"
			);

		self::$CONTROL_CODE_CHARS =
			array(
				chr(0) => "&#0;",
				chr(1) => "&#1;",
				chr(2) => "&#2;",
				chr(3) => "&#3;",
				chr(4) => "&#4;",
				chr(5) => "&#5;",
				chr(6) => "&#6;",
				chr(7) => "&#7;",
				chr(8) => "&#8;",
				chr(14) => "&#14;",
				chr(15) => "&#15;",
				chr(16) => "&#16;",
				chr(17) => "&#17;",
				chr(18) => "&#18;",
				chr(19) => "&#19;",
				chr(20) => "&#20;",
				chr(21) => "&#21;",
				chr(22) => "&#22;",
				chr(23) => "&#23;",
				chr(24) => "&#24;",
				chr(25) => "&#25;",
				chr(26) => "&#26;",
				chr(27) => "&#27;",
				chr(28) => "&#28;",
				chr(29) => "&#29;",
				chr(30) => "&#30;",
				chr(31) => "&#31;"
			);

		self::$INVALID_CODE_CHARS = array(
			chr(128) => '&#8364;',
			chr(130) => '&#8218;',
			chr(131) => '&#402;',
			chr(132) => '&#8222;',
			chr(133) => '&#8230;',
			chr(134) => '&#8224;',
			chr(135) => '&#8225;',
			chr(136) => '&#710;',
			chr(137) => '&#8240;',
			chr(138) => '&#352;',
			chr(139) => '&#8249;',
			chr(140) => '&#338;',
			chr(142) => '&#381;',
			chr(145) => '&#8216;',
			chr(146) => '&#8217;',
			chr(147) => '&#8220;',
			chr(148) => '&#8221;',
			chr(149) => '&#8226;',
			chr(150) => '&#8211;',
			chr(151) => '&#8212;',
			chr(152) => '&#732;',
			chr(153) => '&#8482;',
			chr(154) => '&#353;',
			chr(155) => '&#8250;',
			chr(156) => '&#339;',
			chr(158) => '&#382;',
			chr(159) => '&#376;');

		self::$XML_SPECIAL_CHARS = array(
			"&"   =>"&amp;",
			"<"   =>"&lt;"
			,">"  =>"&gt;"
			,"\"" =>"&quot;"
			,"'"  =>"&apos;"
		);

	}
314859
public static function initialize() {

		$instance = new static();

		/**
		 * Fires right before hook listeners are registered.
		 *
		 * @param HookListenersRegistry $registry
		 */
		do_action( self::ACTION_REGISTER, $instance );

		array_walk(
			$instance->listeners,
			function ( HookListenerInterface $listener ) use ( $instance ) {

				/**
				 * Filters whether to enable the hook listener.
				 *
				 * @param bool                  $enable
				 * @param HookListenerInterface $listener
				 */
				if ( apply_filters( self::FILTER_ENABLED, TRUE, $listener ) ) {
					$hooks = (array) $listener->listen_to();
					array_walk( $hooks, [ $instance, 'listen_hook' ], $listener );
				}
			}
		);

		unset( $instance->listeners );
		$instance->listeners = [];
	}
195654
private function staticScalar() {
    if ($this->currentType === T_ARRAY) {
      $node = new ArrayNode();
      $this->mustMatch(T_ARRAY, $node);
      $this->mustMatch('(', $node, 'openParen');
      $this->staticArrayPairList($node, ')');
      $this->mustMatch(')', $node, 'closeParen', TRUE);
      return $node;
    }
    elseif ($this->currentType === '[') {
      $node = new ArrayNode();
      $this->mustMatch('[', $node);
      $this->staticArrayPairList($node, ']');
      $this->mustMatch(']', $node, NULL, TRUE);
      return $node;
    }
    else {
      return $this->expr(TRUE);
    }
  }
570660
static Object execute(Config config, ICallback callback) {
		return MAIN.execute(config, callback);
	}
20410
public static function findAll()
    {
        $s = new static();

        self::$db->select($s::$entity_table);

        return self::$db->objectSet(self::$child_class);
    }
520189
public static function __static()
	{
		Types::$NullType					= Type::FromNameAndTypeCode( Type::null_, TypeCode::Null_ );
		Types::$ArrayType					= Type::FromNameAndTypeCode( Type::assocArray, TypeCode::AssocArray );
		Types::$BoolType					= Type::FromNameAndTypeCode( Type::bool, TypeCode::Boolean );
		Types::$BooleanType					= Types::$BoolType;
		Types::$ByteType					= Type::FromNameAndTypeCode( Type::byte, TypeCode::Int32 );
		Types::$CharType					= Type::FromNameAndTypeCode( Type::char, TypeCode::String );
		Types::$DateTimeIntervalType		= Type::FromNameAndTypeCode( Type::dateTimeInterval, TypeCode::DateTimeInterval );
		Types::$DateTimeValueType			= Type::FromNameAndTypeCode( DateTimeValue::$CLASSNAME, TypeCode::DateTime );
		Types::$DateValueType				= Type::FromNameAndTypeCode( DateValue::$CLASSNAME, TypeCode::DateTime );
		Types::$DayTimeDurationValueType	= Type::FromNameAndTypeCode( DayTimeDurationValue::$CLASSNAME, TypeCode::DateTimeInterval );
		// Types::$DecimalType				= Type::FromNameAndTypeCode( Type::decimal, TypeCode::Float );
		Types::$DecimalType					= Type::FromNameAndTypeCode( DecimalValue::$CLASSNAME, TypeCode::Decimal );
		Types::$DurationValueType			= Type::FromNameAndTypeCode( DurationValue::$CLASSNAME, TypeCode::DateTimeInterval );
		Types::$FloatType					= Type::FromNameAndTypeCode( Type::float, TypeCode::Float );
		Types::$DoubleType					= Type::FromNameAndTypeCode( Type::double, TypeCode::Float );
		// Types::$DoubleType					= Types::$FloatType;
		Types::$Int16Type					= Type::FromNameAndTypeCode( Type::int16, TypeCode::Int32 );
		Types::$Int32Type					= Type::FromNameAndTypeCode( Type::int32, TypeCode::Int32 );
		Types::$Int64Type					= Type::FromNameAndTypeCode( Type::int64, TypeCode::Int32 );
		Types::$IntType						= Types::$Int32Type;
		Types::$IntegerType					= Type::FromNameAndTypeCode( Integer::$CLASSNAME, TypeCode::Float );
		// Types::$LongType					= Types::$Int64Type;
		Types::$LongType					= Type::FromNameAndTypeCode( Long::$CLASSNAME, TypeCode::Int64 );
		Types::$ObjectType					= Type::FromNameAndTypeCode( Type::object, TypeCode::Object );
		Types::$SByteType					= Type::FromNameAndTypeCode( Type::sbyte, TypeCode::Int32 );
		Types::$ShortType					= Types::$Int16Type;
		Types::$StringType					= Type::FromNameAndTypeCode( Type::string, TypeCode::String );
		Types::$TimeValueType				= Type::FromNameAndTypeCode( "lyquidity\XPath2\Value\TimeValue", TypeCode::DateTime );
		Types::$UInt16Type					= Type::FromNameAndTypeCode( Type::uint16, TypeCode::Int32 );
		Types::$UInt32Type					= Type::FromNameAndTypeCode( Type::uint32, TypeCode::Int32 );
		Types::$UInt64Type					= Type::FromNameAndTypeCode( Type::uint64, TypeCode::Int32 );

		Types::$AnyUriValueType				= Type::FromNameAndTypeCode( AnyUriValue::$CLASSNAME, TypeCode::Object );
		Types::$Base64BinaryValueType		= Type::FromNameAndTypeCode( Base64BinaryValue::$CLASSNAME, TypeCode::Object );
		Types::$ENTITIESValueType			= Type::FromNameAndTypeCode( ENTITIESValue::$CLASSNAME, TypeCode::Object );
		Types::$GDayValueType				= Type::FromNameAndTypeCode( GDayValue::$CLASSNAME, TypeCode::DateTime );
		Types::$GMonthValueType				= Type::FromNameAndTypeCode( GMonthValue::$CLASSNAME, TypeCode::DateTime );
		Types::$GMonthDayValueType			= Type::FromNameAndTypeCode( GMonthDayValue::$CLASSNAME, TypeCode::DateTime );
		Types::$GYearMonthValueType			= Type::FromNameAndTypeCode( GYearMonthValue::$CLASSNAME, TypeCode::DateTime );
		Types::$GYearValueType				= Type::FromNameAndTypeCode( GYearValue::$CLASSNAME, TypeCode::DateTime );
		Types::$HexBinaryValueType			= Type::FromNameAndTypeCode( HexBinaryValue::$CLASSNAME, TypeCode::Object );
		Types::$IDREFSValueType				= Type::FromNameAndTypeCode( IDREFSValue::$CLASSNAME, TypeCode::Object );
		Types::$NMTOKENSValueType			= Type::FromNameAndTypeCode( NMTOKENSValue::$CLASSNAME, TypeCode::Object );
		Types::$QNameValueType				= Type::FromNameAndTypeCode( QNameValue::$CLASSNAME, TypeCode::Object );
		Types::$UntypedAtomicType			= Type::FromNameAndTypeCode( UntypedAtomic::$CLASSNAME, TypeCode::Object );
		Types::$YearMonthDurationValueType	= Type::FromNameAndTypeCode( YearMonthDurationValue::$CLASSNAME, TypeCode::DateTimeInterval );
		Types::$UNION						= Type::FromNameAndTypeCode( Type::union, TypeCode::UNION );
	}
784436
static function initialize()
    {
        $contentINI = eZINI::instance( 'content.ini' );
        foreach( array_unique( $contentINI->variable( 'EditSettings', 'ExtensionDirectories' ) ) as $extensionDirectory )
        {
            $fileName = eZExtension::baseDirectory() . '/' . $extensionDirectory . '/content/' . $extensionDirectory . 'handler.php';
            if ( file_exists( $fileName ) )
            {
                include_once( $fileName );
                $className = $extensionDirectory . 'Handler';
                $storeActionList = call_user_func_array( array( $className, 'storeActionList' ), array() );
                foreach( $storeActionList as $storeAction )
                {
                    eZContentObjectEditHandler::addStoreAction( $storeAction );
                }
            }
            else
            {
                eZDebug::writeError( 'Cound not find content object edit handler ( defined in content.ini ) : ' . $fileName );
            }
        }
    }
975429
static function is_ajax_action_static( $actions, $module_id = null ) {
            // Verify it's an ajax call.
            if ( ! self::is_ajax() ) {
                return false;
            }


            if ( ! empty( $module_id ) ) {
                // Verify the call is relevant for the plugin.
                if ( $module_id != fs_request_get( 'module_id' ) ) {
                    return false;
                }
            }

            // Verify it's one of the specified actions.
            if ( is_string( $actions ) ) {
                $actions = explode( ',', $actions );
            }

            if ( is_array( $actions ) && 0 < count( $actions ) ) {
                $ajax_action = fs_request_get( 'action' );

                foreach ( $actions as $action ) {
                    if ( $ajax_action === self::get_ajax_action_static( $action, $module_id ) ) {
                        return true;
                    }
                }
            }

            return false;
        }