$checked = "checked=\"true\""; } else { $highlight_start = "<font color=red>"; $highlight_end = "</font>"; } print "<li><input name=\"copy_{$count}\" type=\"checkbox\" value=\"" . $the_file . "\" {$checked} {$disabled} > " . $highlight_start . $new_file . $highlight_end . "<br>\n"; } } $count++; } print "</ul>\n"; } // echo '</div>'; if ($mode == "Disable" || $mode == "Enable") { //check to see if any files have been modified $modified_files = getDiffFiles($unzip_dir, $install_file, $mode == 'Enable', $previous_version); if (count($modified_files) > 0) { //we need to tell the user that some files have been modified since they last did an install echo '<script>' . 'function handleFileChange(){'; if (count($modified_files) > 0) { echo 'if(document.getElementById("radio_overwrite_files") != null && document.getElementById("radio_do_not_overwrite_files") != null){ var overwrite = false; if(document.getElementById("radio_overwrite_files").checked){ overwrite = true } } return true;'; } else { echo 'return true;'; } echo '}</script>';
function copyParentFiles() { global $motopressSettings; global $isSupportedTheme; global $theme; $errors = array(); if ($isSupportedTheme) { $parent = $theme->parent(); if ($parent) { //if child theme $skip = array('.', '..'); $parentPath = $motopressSettings['theme_root'] . '/' . $parent->get_stylesheet(); $parentFiles = array_diff(scandir($parentPath), $skip); $childPath = $motopressSettings['theme_root'] . '/' . $motopressSettings['current_theme']; $childFiles = array_diff(scandir($childPath), $skip); $skippedFiles = array('comments', 'filterable-portfolio-loop', 'footer', 'functions', 'header', 'options', 'searchform', 'sidebar', 'slider', 'title'); $patternTemplates = '/^(?!^' . implode('|^', $skippedFiles) . ').+\\.php$/is'; $parentTemplates = preg_grep($patternTemplates, $parentFiles); $childTemplates = preg_grep($patternTemplates, $childFiles); $diffTemplates = array_diff($parentTemplates, $childTemplates); if (!empty($diffTemplates)) { copyFiles($diffTemplates, $parentPath, $childPath, $errors); } //wrapper $parentWrapperPath = $motopressSettings['theme_root'] . '/' . $parent->get_stylesheet() . '/wrapper'; $childWrapperPath = $motopressSettings['theme_wrapper_root']; $diffWrapperFiles = getDiffFiles($parentWrapperPath, $childWrapperPath, $skip, $errors); if (!empty($diffWrapperFiles)) { copyFiles($diffWrapperFiles, $parentWrapperPath, $childWrapperPath, $errors); } //static $parentStaticPath = $motopressSettings['theme_root'] . '/' . $parent->get_stylesheet() . '/static'; $childStaticPath = $motopressSettings['theme_static_root']; $diffStaticFiles = getDiffFiles($parentStaticPath, $childStaticPath, $skip, $errors); if (!empty($diffStaticFiles)) { copyFiles($diffStaticFiles, $parentStaticPath, $childStaticPath, $errors); } //loop /* $parentLoopPath = $motopressSettings['theme_root'] . '/' . $parent->get_stylesheet() . '/loop'; $childLoopPath = $motopressSettings['theme_loop_root']; $diffLoopFiles = getDiffFiles($parentLoopPath, $childLoopPath, $skip, $errors); if (!empty($diffLoopFiles)) { copyFiles($diffLoopFiles, $parentLoopPath, $childLoopPath, $errors); } */ //woo $parentWooPath = $motopressSettings['theme_root'] . '/' . $parent->get_stylesheet() . '/woocommerce'; $childWooPath = $motopressSettings['theme_root'] . '/' . $motopressSettings['current_theme'] . '/woocommerce'; $diffWooFiles = getDiffFiles($parentWooPath, $childWooPath, $skip, $errors); if (!empty($diffWooFiles)) { copyFiles($diffWooFiles, $parentWooPath, $childWooPath, $errors); } } } return $errors; }
/** * Return an array of data to be parsed ... * * @param string $source * @param Collection $seeded * @return array|mixed */ public function getData($source = '', Collection $seeded) { $files = $source ? getFullPathSource($source, $this) : getFilesFromPathByEnv($this); $diffFiles = getDiffFiles($files, $seeded, $this); return self::parseYamlFiles($diffFiles); }