echo "\n{$msg}"; // skip if 'name' field exists if (empty($video['metadata'])) { echo " ... SKIPPED (Empty metadata).\n"; $skipped++; continue; } // skip if 'name' field exists if (array_key_exists('name', $video['metadata'])) { echo " ... SKIPPED ('name' field found in metadata. metadata already mapped).\n"; $skipped++; continue; } // backup data to csv file if (!empty($backupFile)) { backupFile($backupFile, $msg, $video); } // get provider $label = OoyalaApiWrapper::getProviderName($video['labels']); $label = empty($label) ? "No provider name" : OoyalaApiWrapper::formatProviderName($label); echo " ({$label})"; $newMeta = mapMetadata($ingester, $video['metadata']); if (!array_key_exists('name', $newMeta)) { $newMeta['name'] = ''; } echo " ... DONE \n\tNEW Metadata:\n"; compareMetadata($video['metadata'], $newMeta); if (!$dryRun) { $resp = OoyalaAsset::updateMetadata($video['embed_code'], $newMeta); if (!$resp) { $failed++;
function changeChildTheme(&$updateErrors) { $themesPath = get_theme_root(); $skip = array('.', '..', 'CherryFramework', 'twentytwelve', 'twentyeleven', 'twentyten', 'index.php'); $themes = array_diff(scandir($themesPath), $skip); if (!empty($themes)) { foreach ($themes as $theme) { $themePath = $themesPath . '/' . $theme; if (is_dir($themePath) && file_exists($themePath . '/style.css')) { $isCherryChildTheme = isCherryChildTheme($themePath, $theme, $updateErrors); if ($isCherryChildTheme) { if (is_writable($themePath)) { unset($slider_in_header, $slider_in_page_home, $pahe_home_content); writeLog(PHP_EOL . 'Child theme: ' . $themePath); $files = scandir($themePath); $header_php = array_intersect($files, array('header.php')); if (!empty($header_php)) { $templatePath = $themePath . '/header.php'; $content = file_get_contents($templatePath); if (stripos($content, '"static/static-slider"') !== false) { $slider_in_header = true; } } if (!isset($slider_in_header)) { if (is_dir($themePath . "/wrapper")) { $nestedFiles = scandir($themePath . "/wrapper"); $header_wrapper_php = array_intersect($nestedFiles, array('wrapper-header.php')); if (!empty($header_wrapper_php)) { $header_wrapper_php_path = $themePath . '/wrapper/wrapper-header.php'; $content = file_get_contents($header_wrapper_php_path); if (stripos($content, '"static/static-slider"') !== false) { $slider_in_header = true; } } } } if (!isset($slider_in_header)) { $page_home_php = array_intersect($files, array('page-home.php')); if (!empty($page_home_php)) { $templatePath = $themePath . '/page-home.php'; $content = file($templatePath); for ($i = 0, $arrayCount = count($content); $i < $arrayCount; $i++) { if (stripos($content[$i], '"static/static-slider"') !== false) { $slider_in_page_home = $i; } if (stripos($content[$i], '"page-home.php"') !== false) { $pahe_home_content = $i; } } if (!isset($slider_in_page_home)) { array_splice($content, $pahe_home_content + 1, 0, "\t<div class=\"row\">\n\t\t<div class=\"span12\" data-motopress-type=\"static\" data-motopress-static-file=\"static/static-slider.php\">\n\t\t\t<?php get_template_part(\"static/static-slider\"); ?>\n\t\t</div>\n\t</div>\n"); writeLog('Change page-home.php'); if (file_put_contents($templatePath, $content)) { writeLog('Save ' . $templatePath); } else { $updateErrors[] = 'Failed to save ' . $templatePath; writeLog('Failed to save ' . $templatePath); } } } } $stylesheet = array_intersect($files, array('style.css')); $stylePath = $themePath . '/style.css'; if (!empty($stylesheet)) { $styleContent = file($stylePath); if ($styleContent) { for ($i = 0, $arrayCount = count($styleContent); $i < $arrayCount; $i++) { if (stripos($styleContent[$i], "/*--") !== false) { $styleContentChange = array(); } if (isset($styleContentChange)) { $styleContentChange[$i] = $styleContent[$i]; } if (stripos($styleContent[$i], "--*/") !== false) { break; } } array_push($styleContentChange, "\n/* ----------------------------------------\n\tPlease, You may put custom CSS here\n---------------------------------------- */\n"); if (file_put_contents($stylePath, $styleContentChange)) { writeLog('Save ' . $stylePath); } else { $updateErrors[] = 'Failed to save ' . $stylePath; writeLog('Failed to save ' . $stylePath); } } else { $updateErrors[] = 'Failed to read ' . $stylesheet; writeLog('Failed to read ' . $stylesheet); } } if (is_dir($themePath . "/static")) { $nestedFiles = scandir($themePath . "/static"); $staticSlider = array_intersect($nestedFiles, array('static-slider.php')); $staticSliderPath = $themePath . '/static/static-slider.php'; unset($sliderStatic, $new_function); if (!empty($staticSlider)) { $backupFileStatic = backupFile($staticSliderPath); if ($backupFileStatic) { $staticSliderContent = file($staticSliderPath); if ($staticSliderContent) { $static_slider_dom_1 = "<?php if(of_get_option('slider_type') != 'none_slider'){ ?>\n"; $static_slider_dom_2 = "\t<?php get_slider_template_part(); ?>\n"; $static_slider_dom_3 = "\n<?php }else{ ?>\n\t<div class=\"slider_off\"></div>\n<?php } ?>\n"; for ($i = 0, $arrayCount = count($staticSliderContent); $i < $arrayCount; $i++) { if (stripos($staticSliderContent[$i], "get_template_part('slider')") !== false) { $sliderStatic = $i; } if (stripos($staticSliderContent[$i], "get_slider_template_part") !== false) { $new_function = $i; } } if (!isset($sliderStatic) && !isset($new_function)) { $staticSliderContent = "<?php /* Static Name: Slider */ ?>\n<?php if(of_get_option('slider_type') != 'none_slider'){ ?>\n\t<div id=\"slider-wrapper\" class=\"slider\">\n\t\t<div class=\"container\">\n\t\t\t<?php get_slider_template_part(); ?>\n\t\t</div>\n\t</div><!-- .slider -->\n<?php }else{ ?>\n\t<div class=\"slider_off\"><!--slider off--></div>\n<?php } ?>"; } else { if (!isset($new_function)) { $staticSliderContent[$sliderStatic] = $static_slider_dom_2; array_splice($staticSliderContent, 1, 0, $static_slider_dom_1); array_push($staticSliderContent, $static_slider_dom_3); } } if (file_put_contents($staticSliderPath, $staticSliderContent)) { writeLog('Save ' . $staticSliderPath); } else { $updateErrors[] = 'Failed to save ' . $staticSliderPath; writeLog('Failed to save ' . $staticSliderPath); } } else { $updateErrors[] = 'Failed to read ' . $staticSlider; writeLog('Failed to read ' . $staticSlider); } } else { $updateErrors[] = 'Failed to backup ' . $staticSliderPath; writeLog('Failed to backup ' . $staticSliderPath); } } } } else { $updateErrors[] = $themePath . ' is not writable'; writeLog($themePath . ' is not writable'); } } } } } }
<?php /** * This function is to receive easylog upload files from ManoboClient the files * will be processed directly also and a notice will be sent to IT Team on failure * * @author IT TEAM BONOFACTUM * @created Sep 6, 2013 3:12:53 PM */ $file_path = uploadFileMCHandler(DHL_EASYLOG_EXPORT_PATH_OPEN); if (is_file($file_path)) { backupFile($file_path, DHL_EASYLOG_EXPORT_PATH_BACKUP); }
mkdir(EXCHANGE_LOCAL_ARCHIVE_PATH, 0750); } //Prepare exchange central folder if (!is_dir(EXCHANGE_CENTRAL_PATH)) { mkdir(EXCHANGE_CENTRAL_PATH, 0750); } //Prepare exchange central open folder if (!is_dir(EXCHANGE_CENTRAL_OPEN_PATH)) { mkdir(EXCHANGE_CENTRAL_OPEN_PATH, 0750); } //CREATE XML FILE LOCALLY $xml_filename = EXCHANGE_LOCAL_OPEN_PATH . $xml_file; $xmlt->setOutputVars($xml_filename); $xmlt->printOutput('F'); $logger->write("{$xml_file} created, {$counter} orders added"); echo $xml_filename . ' created<br/>'; unset($xmlt); //BACKUP AS ARCHIVE backupFile($xml_filename, EXCHANGE_LOCAL_ARCHIVE_PATH, false); $logger->write("xml archived"); //Send file to exchange central open folder $target_central_open_filename = EXCHANGE_CENTRAL_OPEN_PATH . $xml_file; rename($xml_filename, $target_central_open_filename); $logger->write("xml copied to exchange central folder"); } else { $logger->write("No depot refill found"); echo "No xml created<br/>"; } $logger->write("END"); $logger->close(); echo "Done, last run on {$today}";