* $writer = new ezcConfigurationArrayWriter( "settings/site.php" ); * $writer->setConfig( $configurationObject ); * $writer->save(); * * That makes the class figure out the location and name values automatically. * * Or generally use the init() function: * * $writer = new ezcConfigurationArrayWriter(); * $writer->init( "settings", "site", $configurationObject ); * $writer->save(); * * * For more information on file based configurations see {@link * ezcConfigurationFileWriter}. * * This class uses exceptions and will throw them when the conditions for the * operation fails somehow. * * Files are required to have the suffix .php, as this allows PHP accelerators * to cache the content for even faster retrieval. * * @package Configuration * @version //autogen// * @mainclass */ class ezcConfigurationArrayWriter extends ezcConfigurationFileWriter { /** * Returns the suffix used in the storage filename. * * @return string */ protected function getSuffix() { return 'php'; } /** * Writes the settings and comments to disk * * This method loops over all groups and settings and write those to disk. * For the settings itself it will call writeSetting() which also detects * arrays and handles those recursively. * * @param resource $fp The filepointer of the file to write * @param array $settings The structure containing settings * @param array $comments The structure containing the comments for the * settings */ protected static function writeSettings( $fp, $settings, $comments = array() ) { fwrite( $fp, " $settings, 'comments' => $comments ), true ); fwrite( $fp, 'return ' . $serializedSettings . ";\n" ); fwrite( $fp, "?>\n" ); } } ?>