public function insertSnippet(Plugin $plugin, $text, &$log = '')
    {
        $snippetProperties = $this->readProperties($text);
        $configContents    = file_get_contents($this->configFileLocation);

        if (stripos($configContents, "BEGIN PLUGIN CONFIG: {$plugin->Slug}") === false) {

            /* foreach($snippetProperties as $name => $value) {
                if($this->ApplicationContext->propertyExists($name))
                    $log .= "
                            /////////////////////////////
                            WARNING, plugin configuration property exists in context already: ['.$name.']
                            /////////////////////////////\n\n";
            } */
            $configContents .= "\n\n// BEGIN PLUGIN CONFIG: {$plugin->Slug}\n";
            $configContents .= $text."\n";
            $configContents .= "// END PLUGIN CONFIG: {$plugin->Slug}\n";

            if(!is_writable($this->configFileLocation))
            {
                $log .= "/////////////////////////////
WARNING, UNABLE TO WRITE TO YOUR CONFIG FILE.
PLEASE ADD THE FOLLOWING TO [".$this->configFileLocation."]:\n
".$configContents."\n
/////////////////////////////";

                return false;
            } else {

                FileSystemUtils::safeFilePutContents($this->configFileLocation, $configContents);
            }
        } else {
            foreach($snippetProperties as $name => $value)
                if (!$this->ApplicationContext->propertyExists($name))
                    $log .= "
/////////////////////////////
WARNING, YOU MUST ADD THE NEW CONFIG PROPERTY TO ".$this->configFileLocation.":
\$properties['$name'] = ".$value.";
/////////////////////////////\n\n";

            return false;
        }

        return true;
    }
public function insertSnippet(Plugin $plugin, $text, &$log = '')
    {
        $snippetProperties = $this->readProperties($text);
        $configContents    = file_get_contents($this->configFileLocation);

        if (stripos($configContents, "BEGIN PLUGIN CONFIG: {$plugin->Slug}") === false) {

            /* foreach($snippetProperties as $name => $value) {
                if($this->ApplicationContext->propertyExists($name))
                    $log .= "
                            /////////////////////////////
                            WARNING, plugin configuration property exists in context already: ['.$name.']
                            /////////////////////////////\n\n";
            } */
            $configContents .= "\n\n// BEGIN PLUGIN CONFIG: {$plugin->Slug}\n";
            $configContents .= $text."\n";
            $configContents .= "// END PLUGIN CONFIG: {$plugin->Slug}\n";

            if(!is_writable($this->configFileLocation))
            {
                $log .= "/////////////////////////////
WARNING, UNABLE TO WRITE TO YOUR CONFIG FILE.
PLEASE ADD THE FOLLOWING TO [".$this->configFileLocation."]:\n
".$configContents."\n
/////////////////////////////";

                return false;
            } else {

                FileSystemUtils::safeFilePutContents($this->configFileLocation, $configContents);
            }
        } else {
            foreach($snippetProperties as $name => $value)
                if (!$this->ApplicationContext->propertyExists($name))
                    $log .= "
/////////////////////////////
WARNING, YOU MUST ADD THE NEW CONFIG PROPERTY TO ".$this->configFileLocation.":
\$properties['$name'] = ".$value.";
/////////////////////////////\n\n";

            return false;
        }

        return true;
    }
public function insertSnippet ( Plugin $ plugin , $ text , & $ log = '' ) { $ snippetProperties = $ this -> readProperties ( $ text ) ; $ configContents = file_get_contents ( $ this -> configFileLocation ) ; if ( stripos ( $ configContents , "BEGIN PLUGIN CONFIG: {$plugin->Slug}" ) === false ) { /* foreach($snippetProperties as $name => $value) {
                if($this->ApplicationContext->propertyExists($name))
                    $log .= "
                            /////////////////////////////
                            WARNING, plugin configuration property exists in context already: ['.$name.']
                            /////////////////////////////\n\n";
            } */ $ configContents .= "\n\n// BEGIN PLUGIN CONFIG: {$plugin->Slug}\n" ; $ configContents .= $ text . "\n" ; $ configContents .= "// END PLUGIN CONFIG: {$plugin->Slug}\n" ; if ( ! is_writable ( $ this -> configFileLocation ) ) { $ log .= "/////////////////////////////
WARNING, UNABLE TO WRITE TO YOUR CONFIG FILE.
PLEASE ADD THE FOLLOWING TO [" . $ this -> configFileLocation . "]:\n
" . $ configContents . "\n
/////////////////////////////" ; return false ; } else { FileSystemUtils :: safeFilePutContents ( $ this -> configFileLocation , $ configContents ) ; } } else { foreach ( $ snippetProperties as $ name => $ value ) if ( ! $ this -> ApplicationContext -> propertyExists ( $ name ) ) $ log .= "
/////////////////////////////
WARNING, YOU MUST ADD THE NEW CONFIG PROPERTY TO " . $ this -> configFileLocation . ":
\$properties['$name'] = " . $ value . ";
/////////////////////////////\n\n" ; return false ; } return true ; }
Write the specified text to the config file

@param Plugin $plugin The plugin that requested the addition
@param string $text   The text to add
@param string &$log   Holds a log of the changes made

@return true
Write the specified text to the config file