addFunc('is_session_started', (function() { if ( \php_sapi_name() !== 'cli' ) { if ( version_compare(phpversion(), '5.4.0', '>=') ) { return session_status() === \PHP_SESSION_ACTIVE ? true : false; } else { return session_id() === '' ? false : true; } } return false; })); \frdl\webfan\App::God(false)->addFunc('is_ssl', (function() { if ( isset($_SERVER) && isset($_SERVER['HTTPS']) ) { if ( 'on' == strtolower($_SERVER['HTTPS']) ) return true; if ( '1' == $_SERVER['HTTPS'] ) return true; } elseif (isset($_SERVER) && isset($_SERVER['SERVER_PORT']) && ( '443' == $_SERVER['SERVER_PORT'] ) ) { return true; } return false; })); \frdl\webfan\App::God(false)->addFunc('getResponseHeader', (function($header) { $headers = \headers_list(); $header = trim($header,': '); $result = false; foreach ($headers as $hdr) { if (\stripos($hdr, $header) !== false) { $e = explode(':' , $hdr); $result = trim($e[1]); } } return $result; })); //http://php.net/manual/en/function.is-resource.php //$isResource = is_resource($a) || ($a !== null && !is_scalar($a) && !is_array($a) && !is_object($a)); \frdl\webfan\App::God(false)->addFunc('isResource', (function($a, &$open = null) { $open = is_resource($a); return $open || ($a !== null && !is_scalar($a) && !is_array($a) && !is_object($a)); })); \frdl\webfan\App::God(false)->addFunc('unparse_url', (function($parsed_url) { $scheme = isset($parsed_url['scheme']) ? $parsed_url['scheme'] . '://' : ''; $host = isset($parsed_url['host']) ? $parsed_url['host'] : ''; $port = isset($parsed_url['port']) ? ':' . $parsed_url['port'] : ''; $user = isset($parsed_url['user']) ? $parsed_url['user'] : ''; $pass = isset($parsed_url['pass']) ? ':' . $parsed_url['pass'] : ''; $pass = ($user || $pass) ? "$pass@" : ''; $path = isset($parsed_url['path']) ? $parsed_url['path'] : ''; $query = isset($parsed_url['query']) ? '?' . $parsed_url['query'] : ''; $fragment = isset($parsed_url['fragment']) ? '#' . $parsed_url['fragment'] : ''; return "$scheme$user$pass$host$port$path$query$fragment"; })); //((isset($headers['X-Flow-AjaxLinkBoddystripped']))?$headers['X-Flow-AjaxLinkBoddystripped']:'') //rewrite_links=for-inline \frdl\webfan\App::God(false)->addFunc('request.is_ajax', (function($server = null){ if(null===$server){ $server=$_SERVER; } $headers = (is_object($server) && true === $server instanceof \Symfony\Component\HttpFoundation\Request) ? $server->headers : \frdl\webfan\App::God(false)->parseHeaders($server); return ((isset($headers['X-Requested-With']) && 'XMLHttpRequest'===$headers['X-Requested-With']) || (isset($headers['x-requested-with']) && 'x-requested-with'===strtolower($headers['x-requested-with'])) || ( isset($headers['X-Flow-AjaxLinkBoddystripped']) ) || (isset($_REQUEST['rewrite_links']) && 'for-inline' === $_REQUEST['rewrite_links']) ) ? true : false; })); \frdl\webfan\App::God(false)->addFunc('link.relative', (function($link){ $u = parse_url($link); unset($u['scheme']); unset($u['host']); $link=\frdl\webfan\App::God(false)->unparse_url($u); return $link; })); \frdl\webfan\App::God(false)->addFunc('link.absolute', (function($link){ $u = parse_url($link); if(!isset($u['scheme']))$u['scheme']=( true===\frdl\webfan\App::God(false)->is_ssl() ) ? 'https' : 'http'; if(!isset($u['host']))$u['host']=(isset($_ENV['FRDLWEB_TARGET_HOST'])) ? getenv('FRDLWEB_TARGET_HOST') : (isset($_SERVER['SERVER_NAME']) ) ? $_SERVER['SERVER_NAME'] : $_SERVER['HTTP_HOST']; $link=\frdl\webfan\App::God(false)->unparse_url($u); return $link; })); \frdl\webfan\App::God(false)->addFunc('file.format_size', (function($size){ $units = explode(' ', 'B KB MB GB TB PB'); $mod = 1024; for ($i = 0; $size > $mod; $i++) { $size /= $mod; } $endIndex = strpos($size, ".")+3; return substr( $size, 0, $endIndex).' '.$units[$i]; })); \frdl\webfan\App::God(false)->addFunc('close_html_open_tags', (function() { $args = func_get_args(); $html = $args[0]; preg_match_all("#<([a-z]+)(?#iU",$html,$result); $openedtags=$result[1]; #put all closed tags into an array preg_match_all("##iU",$html,$result); $closedtags=$result[1]; $len_opened = count($openedtags); # all tags are closed if(count($closedtags) == $len_opened){ return $html; } $openedtags = array_reverse($openedtags); # close tags for($i=0;$i < $len_opened;$i++) { if (!in_array($openedtags[$i],$closedtags)){ $html .= ''; } else { unset($closedtags[array_search($openedtags[$i],$closedtags)]); } } return $html; })); \frdl\webfan\App::God(false)->addFunc('parseHeaders', (function($serverVars = null, &$ifNoneMatch = null, &$ifModifiedSince=null){ if( !is_array($serverVars))$serverVars = $_SERVER; $headers = array(); foreach($_SERVER as $key=>$value) { if (substr($key,0,5)=="HTTP_") { $key=str_replace(" ","-",ucwords(strtolower(str_replace("_"," ",substr($key,5))))); $headers[$key]=$value; if( $key == 'If-None-Match' ) { $ifNoneMatch = $headers['If-None-Match']; if(substr($ifNoneMatch, 0, 1) !== '"')$ifNoneMatch = null; } if( $key == 'If-Modified-Since' ) { $ifModifiedSince = $headers['If-Modified-Since']; } } } return $headers; })); }//constructor } __halt_compiler();----SIGNATURE:----dL2+HOBVx3KyuHWWaC5/zKGYhORxmIH7YV3SjrBBtgGExJ4tdykc+ZxF1zYdU8+c0joRKJaTV7vYvjaEVnH30FHLy2htl1uaEdZwANiCPoV3kZqxSCgW2mrT4nU7SSVzMY+2YDUTyRnzq0Uze3NLXTDJ/kzytnAdVk8Y0BJPGXy1YbnPkpVDrq1o2IdibmvQug4xFGja/TWToNxa1mu1Tq7Mh62MzMP8BBvRcMPFDqdZT3f6piH+xRRw60nqPyXfxiNigOFAakR2JoBAG6oSJlK1UbwlAsbQXF7CbtD5sF1tfr3RvXU0NHfrC++nOoW765ctqJlChMy8CW+hUIwFqpI7OvIahkskJSTLuUmSKAsd57B53TQnye3IsvEpaJNvrRNnh0cKj6dTVnbz40QQYR+q3dB3aJN4aWUinjjeUTAXxSFInlx/4OjYe0Q2C0b1aOmb9g30IS+Jt1BnbzCAgQSmm5hj1oB8cJnzM7CCTcac4JsiO+rvKTk1oErfKg2WvuCSZ2Lzt9ajGN+SDVRFy0NFh32ShcQ1dMzFfYH5KiEkKz6YS81UfpOv34kx8rzaphe3hOZWoum/dO+gYZgAPhsLvuj9p5EY7TBTXXjmJ65aWenF/c9BRI65FR0RNhyWbmWWUPHiRvGZQsJUVlcRN0M89vkADLVcmXg1nO7rnjY=----ATTACHMENT:----MTY4OTkwNjcwMjI3NzIxOCA4Mjc0NTEwNDI2ODkxMzczIDc5NzA1NTMxOTE3NjY5Ng==