/** * Read and return plugin info from top of a plugin file. * * @param string $plugin_file - a file from the /plugins folder * @return array|false */ public function readThemeMeta($h, $theme = 'default') { if (!$theme) { $theme = rtrim(THEME, '/'); } // Include the generic_pmd class that reads post metadata from the a plugin require_once EXTENSIONS . 'GenericPHPConfig/class.metadata.php'; $metaReader = new generic_pmd(); $plugin_metadata = $metaReader->read(THEMES . $theme . '/index.php'); if ($plugin_metadata) { return $plugin_metadata; } else { return false; } }
/** * Read and return plugin info from top of a plugin file. * * @param string $plugin_file - a file from the /plugins folder * @return array|false */ public function readPluginMeta($h, $folder = '') { if (!$folder) { $folder = rtrim(PLUGINS, '/'); } // Include the generic_pmd class that reads post metadata from the a plugin require_once EXTENSIONS . 'GenericPHPConfig/class.metadata.php'; $metaReader = new \generic_pmd(); $plugin_metadata = $metaReader->read(PLUGINS . $folder . '/' . $folder . '.php'); if (!$plugin_metadata) { $h->showMessage('File "' . $folder . '/' . $folder . '.php"' . ' could not be found', 'red'); return false; } return $plugin_metadata; }
/** * Read and return plugin info from top of a plugin file. * * @param string $plugin_file - a file from the /plugins folder * @return array|false */ public function readPluginMeta($plugin_file) { if ($plugin_file === 'placeholder.txt' || $plugin_file === 'README.md') { return false; } // Include the generic_pmd class that reads post metadata from the a plugin require_once EXTENSIONS . 'GenericPHPConfig/class.metadata.php'; $metaReader = new \generic_pmd(); $plugin_metadata = $metaReader->read(PLUGINS . $plugin_file . "/" . $plugin_file . ".php"); if ($plugin_metadata) { return $plugin_metadata; } else { return false; } }