HtmlToText
. **************************************************************************/ function neofrag() { global $neofrag; return $neofrag; } function check_file($dir, $force = false) { if ($dir === '') { return false; } static $cache; if (!isset($cache[$dir]) || $force) { $dirs = explode('/', $dir); $exists = true; foreach (array_keys($dirs) as $i) { if (!isset($cache[$path = implode('/', array_slice($dirs, 0, $i + 1))]) || $force) { $cache[$path] = $exists ? file_exists($path) : false; } $exists = $cache[$path]; } } return $cache[$dir]; } ob_start(); define('neofrag_cms', dirname(__file__)); define('neofrag_memory', memory_get_peak_usage()); define('neofrag_time', microtime(true)); define('neofrag_version', 'alpha 0.1.6.1'); ini_set('default_charset', 'utf8'); ini_set('mbstring.func_overload', 7); mb_regex_encoding('utf-8'); mb_internal_encoding('utf-8'); spl_autoload_register(function($name){ if ($override = substr($name = strtolower($name), 0, 2) == 'o_') { $name = substr($name, 2); } $dir = $override ? 'overrides' : 'neofrag'; if (file_exists($file = $dir.'/classes/'.$name.'.php')) { require_once $file; } else if (preg_match('/^(.+?)_(.+)/', $name, $match) && file_exists($dir.'/libraries/'.$match[1].'.php') && file_exists($file = $dir.'/libraries/'.$match[1].'s/'.$match[2].'.php')) { require_once $file; } else if (file_exists($file = $dir.'/libraries/'.$name.'.php')) { require_once $file; } }); function load($name) { $args = array_slice(func_get_args(), 1); $override = false; if (substr($name, 0, 2) == 'o_') { $override = true; } else if (class_exists('o_'.$name)) { $name = 'o_'.$name; $override = true; } $r = new reflectionclass($name); if ($debug = neofrag() === null || !isset(neofrag()->user) || !isset(neofrag()->debug) || neofrag()->debug->is_enabled()) { $memory = memory_get_usage(); $time = microtime(true); } $object = $r->newinstanceargs($args); if ($debug) { $object->memory = [$memory, memory_get_usage()]; $object->time = [$time, microtime(true)]; if ($override) { $object->override = true; } } return $object; } $neofrag = load('loader', [ 'assets' => [ 'assets', 'overrides/themes/default', 'neofrag/themes/default' ], 'authenticators' => [ 'authenticators' ], 'config' => [ 'overrides/config', 'neofrag/config', 'config' ], 'core' => [ 'overrides/core', 'neofrag/core' ], 'helpers' => [ 'overrides/helpers', 'neofrag/helpers' ], 'lang' => [ 'overrides/lang', 'neofrag/lang' ], 'libraries' => [ 'overrides/libraries', 'neofrag/libraries', ], 'modules' => [ 'overrides/modules', 'neofrag/modules', 'modules' ], 'themes' => [ 'overrides/themes', 'neofrag/themes', 'themes' ], 'views' => [ 'overrides/themes/default/views', 'neofrag/themes/default/views', 'overrides/views', 'neofrag/views' ], 'widgets' => [ 'overrides/widgets', 'neofrag/widgets', 'widgets' ] ]); $neofrag->modules = $neofrag->themes = $neofrag->widgets = $neofrag->authenticators = $neofrag->css = $neofrag->js = $neofrag->js_load = $neofrag->modals = []; $neofrag->module = $neofrag->theme = null; foreach ([ 'array', 'assets', 'color', 'countries', 'file', 'geolocalisation', 'dir', 'input', 'location', 'notify', 'output', 'statistics', 'string', 'time', 'user_agent' ] as $helper ) { $neofrag->helper($helper); } foreach([ 'debug', 'output', 'db', 'url', 'config', 'access', 'addons', 'session', 'user', 'groups', 'router' ] as $library ) { $neofrag->{'core_'.$library}; if ($library == 'config' && is_asset() && !preg_match('#^backups/#', $neofrag->url->request)) { asset($neofrag->url->request); } } if (isset($neofrag->config->nf_dispositions_upgrade) && !$neofrag->config->nf_dispositions_upgrade) { foreach ($neofrag->db->from('nf_dispositions')->get() as $disposition) { $rows = unserialize(preg_replace('/o:\d+:"(row|col|widget_view)"/', 'o:8:"stdclass"', preg_replace_callback('/s:\d+:"(.(?:row|col|widget_view).+?)";/', function($a){ return 's:'.strlen($a = preg_replace('/.*_(.+?)$/', '\1', $a[1])).':"'.$a.'";'; }, $disposition['disposition']))); $new_disposition = []; foreach ($rows as $row) { $cols = []; if (!empty($row->cols)) { foreach ($row->cols as $col) { $widgets = []; if (!empty($col->widgets)) { foreach ($col->widgets as $widget) { $new_widget = $neofrag->panel_widget($widget->widget_id); if (!empty($widget->style)) { $new_widget->color(str_replace('panel-', '', $widget->style)); } $widgets[] = $new_widget; } } $new_col = call_user_func_array([$neofrag, 'col'], $widgets); if (!empty($col->size)) { $new_col->size($col->size); } $cols[] = $new_col; } } $new_row = call_user_func_array([$neofrag, 'row'], $cols); if (!empty($row->style)) { $new_row->style($row->style); } $new_disposition[] = $new_row; } $neofrag->db ->where('disposition_id', $disposition['disposition_id']) ->update('nf_dispositions', [ 'disposition' => serialize($new_disposition) ]); $neofrag->config('nf_dispositions_upgrade', true, 'bool'); } dir_create('authenticators'); foreach (['facebook', 'twitter', 'google', 'battle_net', 'steam', 'twitch', 'github', 'linkedin'] as $name) { $neofrag->network('https://raw.githubusercontent.com/neofragcms/neofrag-cms/master/authenticators/'.$name.'.php')->stream('authenticators/'.$name.'.php'); } } echo $neofrag->router()->output; /* neofrag alpha 0.1.6 ./index.php */