Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <pre><code> public function update($form_config_arr) { if( (is_readable($config_file_path)) &amp;&amp; is_writable($config_file_path)) { if(!$config_old_file_content = file_get_contents($config_file_path)) { throw new Exception('Unable to open file!'); } $i = 0; $config_old_arr = array(); $config_new_arr = array(); foreach ($form_config_arr as $constant =&gt; $value){ $config_old_line = $this-&gt;getLine($constant); $config_old_arr[$i] = $config_old_line; if(($value == 'true') || ($value == 'false')){ $config_new_arr[$i] = "define ( '$constant', $value );\n"; }else{ $config_new_arr[$i] = "define ( '$constant', '$value' );\n"; } $i++; } $config_new_file_content = str_replace($config_old_arr, $config_new_arr, $config_old_file_content); $new_content_file_write = file_put_contents($config_file_path, $config_new_file_content); foreach ($config_new_arr as $constant =&gt; $value) { echo $value.'&lt;br/&gt;'; } return true; }else{ throw new Exception('Access denied for '.$config_file_path); return false; } } /** * * @param string $constant * @return string */ private function getLine($constant) { $match_line = ''; $config_file = fopen($config_file_path, "r"); if($config_file) { //Output a line of the file until the end is reached $i = 0; while(!feof($config_file)) { $i++; $config_old_line = fgets($config_file); $pos = strpos($config_old_line, $constant); if( $pos !== false ) { $match_line= $config_old_line; } } fclose($config_file); return $match_line; }else{ throw new Exception('Unable to open file!'); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload