/** * Loads and parses Neon theme config files * @param string $filename Absoluth path to config file * @return array */ function loadConfig($filename) { $file = realpath($filename); if ($file === false) { return false; } $options = NNeon::decode(file_get_contents($file)); return $options; }
<?php require '../../../../../../wp-load.php'; $shortcode = $_REQUEST['plugin']; $ver = $GLOBALS['aitThemeShortcodes'][$shortcode]; if ($ver == 1) { $ver = ''; } $configFile = dirname(__FILE__) . "/{$shortcode}/config{$ver}.neon"; if (!file_exists($configFile)) { $configFile = dirname(__FILE__) . "/{$shortcode}/config.neon"; } $data = NNeon::decode(file_get_contents($configFile, true)); if (isset($data['width'])) { $width = $data['width']; } else { $width = '640'; } if (isset($data['height'])) { $height = $data['height']; } else { $height = '700'; } if (isset($data['title'])) { $title = $data['title']; } else { $title = $shortcode . ' shortcodes'; } wp_enqueue_script('jquery'); wp_enqueue_script('thickbox'); wp_enqueue_style('thickbox');
/** * Reads configuration from NEON file. * @param string file name * @return array */ public function load($file) { return $this->process((array) NNeon::decode(file_get_contents($file))); }