fwrite($handle, $fileAge); flushCache(); } } else { $handle = fopen("cache/latestedit-mob.txt", "w"); fwrite($handle, $fileAge); flushCache(); } if ($autoFlushPlugins) { if (file_exists("cache/compressfilescount-mob.txt")) { $filesCount = file_get_contents("cache/compressfilescount-mob.txt"); if ($filesCount == "" || (int) $filesCount != count($cssFiles) * $compressCSS_mob + count($jsFiles) * $compressJS_mob) { flushCache(); } } else { flushCache(); } } } if (!$autoFlushPlugins) { $cssFiles = array_merge($cssFiles, $cssPluginsArray); $jsFiles = array_merge($jsPluginsArray, $jsFiles); } $totalFiles = 0; /*CSS COMPRESS*/ $css = ''; if ($compressCSS_mob) { if (!file_exists("cache/compressed-mob.css")) { $totalFilesHandle = fopen("cache/compressfilescount-mob.txt", 'w'); $handle = fopen("cache/compressed-mob.css", 'w'); $compressedCss = '';
preg_match('|\\<picture\\>(.+)\\</picture\\>|', $product, $matches); $image = @$matches[1]; preg_match('|\\<name\\>(.+)\\</name\\>|', $product, $matches); $title = @$matches[1]; $title = str_replace('<![CDATA[', '', $title); $title = str_replace(']]>', '', $title); if (!$title && preg_match('|\\<model\\>(.+)\\</model\\>|', $product, $matches)) { $title = @$matches[1]; $title = str_replace('<![CDATA[', '', $title); $title = str_replace(']]>', '', $title); } $ps = mb_strpos($product, '<description>', 0, 'utf-8'); $pe = mb_strpos($product, '</description>', 0, 'utf-8'); $descr = mb_substr($product, $ps + mb_strlen('<description>', 'utf-8'), $pe - $ps - mb_strlen('<description>', 'utf-8'), 'utf-8'); $descr = str_replace('<![CDATA[', '', $descr); $descr = str_replace(']]>', '', $descr); preg_match('|\\<categoryId\\>(.+)\\</categoryId\\>|', $product, $matches); $categoryId = @$matches[1]; //обновление поста importPost(array('id' => $id, 'title' => $title, 'description' => nl2br($descr), 'url' => $url, 'price' => $price, 'currency' => $currency, 'image' => $image, 'category_id' => $categoryId), GdeSlonImport::parseParams($product)); unset($content); } else { break; } } fclose($f); @unlink($path . '/' . $xmlfile); flushCache($cats); wp_mail(get_option('admin_email'), 'Обновление товаров', 'Обновление товаров завершено!'); echo "Done!\n"; exit;