diff --git a/_scripts/add-event-ranges.php b/_scripts/add-event-ranges.php deleted file mode 100644 index 571b2be..0000000 --- a/_scripts/add-event-ranges.php +++ /dev/null @@ -1,67 +0,0 @@ -query($sQuery)) { - foreach ($oStatement as $aRow) { - $iStart = $aRow[0]; - $iEnd = $aRow[1]; - break; - } - $oStart = new DateTime(); - $oStart->setTimeStamp($iStart); - $oEnd = new DateTime(); - $oEnd->setTimeStamp($iEnd); - if ($oStart->diff($oEnd)->format('%a') > 1) { - $sStart = $oStart->format('Y-m-d'); - $sEnd = $oEnd->format('Y-m-d'); - printf(" from %s to %s\n", $sStart, $sEnd); - $aYaml['end_date'] = $sEnd; - $sNewFile = sprintf('%s/%s', $sNewDir, $sBasename); - $sNewContents = '---' . "\n" . yamlDump($aYaml) . '---' . "\n" . trim($sContents); - file_put_contents($sNewFile, $sNewContents); - echo " new file saved!\n"; - } - } else { - echo "Not found!\n"; - } - - -} - -function yamlDump($aData) { - return str_replace("'", null, Yaml::dump($aData, 4, 2)); -} \ No newline at end of file diff --git a/_scripts/convert-captions.php b/_scripts/convert-captions.php deleted file mode 100644 index 16d5ee4..0000000 --- a/_scripts/convert-captions.php +++ /dev/null @@ -1,40 +0,0 @@ - ([^\[]+)\[/caption\]~', $sContents, $aMatches, PREG_SET_ORDER)) { - echo " no caption found\n"; - continue; - } - - foreach ($aMatches as $aMatch) { - $sCaption = sprintf("{%% include caption.html\n width='%d'%s\n image='%s'\n text='%s'\n%%}", $aMatch[1], empty($aMatch[1]) ? null : sprintf("\n image-width='%d'", $aMatch[1]), $aMatch[2], $aMatch[4]); - $sContents = str_replace($aMatch[0], $sCaption, $sContents); - } - - $sNewFile = sprintf('%s/%s', $sNewDir, $sBasename); - $sNewContents = '---' . "\n" . yamlDump($aYaml) . '---' . "\n" . trim($sContents); - file_put_contents($sNewFile, $sNewContents); - echo " new file saved!\n"; -} - -function yamlDump($aData) { - return str_replace("'", null, Yaml::dump($aData, 4, 2)); -} \ No newline at end of file diff --git a/_scripts/convert-characters.php b/_scripts/convert-characters.php deleted file mode 100644 index e80918a..0000000 --- a/_scripts/convert-characters.php +++ /dev/null @@ -1,62 +0,0 @@ - $sConversion) { - unset($aCurrentCharacters[$iCode]); - $sContents = str_replace(sprintf('&#%d;', $iCode), $sConversion, $sContents); - } - if (count($aCurrentCharacters) > 0) { - printf(" unknown characters: %s", implode(', ', array_keys($aCurrentCharacters))); - } - - $sNewFile = sprintf('%s/%s', $sNewDir, $sBasename); - $sNewContents = '---' . "\n" . yamlDump($aYaml) . '---' . "\n" . trim($sContents); - file_put_contents($sNewFile, $sNewContents); - echo " new file saved!\n"; -} -// echo implode("\n", array_unique($aCharacters)); - -function yamlDump($aData) { - return str_replace("'", null, Yaml::dump($aData, 4, 2)); -} \ No newline at end of file diff --git a/_scripts/convert-charset.php b/_scripts/convert-charset.php deleted file mode 100644 index 67600f4..0000000 --- a/_scripts/convert-charset.php +++ /dev/null @@ -1,30 +0,0 @@ - 1) { - $sReference = trim(end($aUrl)); - if (is_numeric($sReference) && isset($aPosts[$sReference][0])) { - $sName = $aPosts[$sReference][0]; - $aName = explode('-', $sName); - $sNewUrl = sprintf('%s/%s/%s.html', $sBase, implode('/', array_slice($aName, 0, 3)), implode('-', array_slice($aName, 3))); - } else { - // printf(" %s\n", $sReference); - $aOptions = []; - foreach ($aPosts as $aPost) { - if (strpos($aPost[1], $sReference) !== false) { - $aName = explode('-', $aPost[0]); - $aOptions[] = sprintf('%s/%s/%s.html', $sBase, implode('/', array_slice($aName, 0, 3)), implode('-', array_slice($aName, 3))); - } - } - $iCount = count($aOptions); - if ($iCount > 0) { - $sNewUrl = implode(';', $aOptions); - } - } - } - if ($sNewUrl) { - printf("%s, %s\n", trim($sUrl), $sNewUrl); - } -} \ No newline at end of file diff --git a/_scripts/convert-event-links.php b/_scripts/convert-event-links.php deleted file mode 100644 index d305084..0000000 --- a/_scripts/convert-event-links.php +++ /dev/null @@ -1,52 +0,0 @@ - $sNewName) { - $iCount = substr_count($sContents, $sName); - if ($iCount > 0) { - printf(" %s > %s (%d)\n", $sName, $sNewName, $iCount); - $sContents = str_replace($sName, $sNewName, $sContents); - } - } - // file_put_contents($sFile, $sNewContents); -} \ No newline at end of file diff --git a/_scripts/convert-urls.php b/_scripts/convert-urls.php deleted file mode 100644 index 47158c1..0000000 --- a/_scripts/convert-urls.php +++ /dev/null @@ -1,41 +0,0 @@ -([^>]+)~', $sContents, $aMatches, PREG_SET_ORDER)) { - echo " no url found\n"; - continue; - } - foreach ($aMatches as $aMatch) { - $sMarkdown = sprintf('[%s](%s%s)', $aMatch[3], $aMatch[1], empty($aMatch[2]) ? null : sprintf(' "%s"', $aMatch[2])); - printf(" replacing: %s\n", $sMarkdown); - $sContents = str_replace($aMatch[0], $sMarkdown, $sContents); - } - - $sNewFile = sprintf('%s/%s', $sNewDir, $sBasename); - $sNewContents = '---' . "\n" . yamlDump($aYaml) . '---' . "\n" . trim($sContents); - file_put_contents($sNewFile, $sNewContents); - echo " new file saved!\n"; -} -// echo implode("\n", array_unique($aCharacters)); - -function yamlDump($aData) { - return str_replace("'", null, Yaml::dump($aData, 4, 2)); -} \ No newline at end of file diff --git a/_scripts/fix-galleries-spain.php b/_scripts/fix-galleries-spain.php deleted file mode 100644 index 2d99c1d..0000000 --- a/_scripts/fix-galleries-spain.php +++ /dev/null @@ -1,31 +0,0 @@ - $x) { - copy($e[$i], $x); -} - -print_r(array_keys(array_diff_key($f, $h))); \ No newline at end of file diff --git a/_scripts/list-gallery-photos.php b/_scripts/list-gallery-photos.php deleted file mode 100644 index 3cae9a1..0000000 --- a/_scripts/list-gallery-photos.php +++ /dev/null @@ -1,20 +0,0 @@ - $sRename) { - unset($aRename[$i]); - $aSplit = explode(' ', $sRename); - if (count($aSplit) > 1) { - list($sOld, $sNew) = explode(' ', $sRename); - $aRename[$sOld] = $sNew; - } -} - -$aPosts = []; -foreach (glob('blog/_posts/*.md') as $sFile) { - $sBasename = basename($sFile, '.md'); - $sContents = file_get_contents($sFile); - - foreach ($aRename as $sOld => $sNew) { - if (strpos($sContents, $sOld) !== false) { - $sContents = str_replace($sOld, $sNew, $sContents); - } - } - $sNewFile = sprintf('%s/%s.md', $sNewDir, $sBasename); - - file_put_contents($sNewFile, $sContents); -} - -foreach ($aRename as $sOld => $sNew) { - $sOldFile = sprintf('%s/%s.md', $sNewDir, $sOld); - $sNewFile = sprintf('%s/%s.md', $sNewDir, $sNew); - rename($sOldFile, $sNewFile); -} diff --git a/_scripts/wordpress-galleries.php b/_scripts/wordpress-galleries.php deleted file mode 100644 index 1ec0998..0000000 --- a/_scripts/wordpress-galleries.php +++ /dev/null @@ -1,61 +0,0 @@ -query($sQuery)) { - $aCommands = []; - foreach ($oStatement as $aRow) { - $iId = $aRow['gid']; - $sTitle = $aRow['title']; - $sPath = $aRow['path']; - $sDescription = $aRow['galdesc']; - $sQuery = sprintf('SELECT pid, filename, description, imagedate FROM wp_ngg_pictures WHERE galleryid = %d', $iId); - $aFiles = []; - if ($oStatement = $oPDO->query($sQuery)) { - foreach ($oStatement as $aRow) { - $iYear = substr($aRow['imagedate'], 0, 4); - $aFiles[basename($aRow['filename'])] = [ - 'id' => $aRow['pid'], - 'title' => '', - 'comment' => utf8_encode($aRow['description']) - ]; - } - $sDir = str_replace('wp-content/gallery/', null, $sPath); - if (preg_match('/-[\d]{4}/', $sDir, $aMatch)) { - $sCleanDir = str_replace($aMatch[0], null, $sDir); - } else { - $sCleanDir = $sDir; - } - $sName = sprintf('%d-%s', $iYear, strtolower(str_replace(' ', '-', $sCleanDir))); - $aYaml = getMetaYaml($sDir, false, $sName, $sTitle, utf8_encode($sDescription)); - $aYaml['id'] = $iId; - $aYaml['files'] = $aFiles; - $sGalleryDir = sprintf('%s/%s', $sSourceDir, $sDir); - if (!is_dir($sGalleryDir)) { - printf("Path does not exist: %s\n", $sGalleryDir); - continue; - } - writeMetaYaml($sGalleryDir, $aYaml); - $aCommands[] = sprintf('call _scripts/generate-gallery %s "%s"', $sName, $sGalleryDir); - } else { - die('Failed to get pictures data'); - } - } - $aCommands[] = 'yekyll build'; - file_put_contents(sprintf('%s/commands.bat', $sSourceDir), implode("\n", $aCommands)); -} else { - die('Failed to get gallery data'); -} \ No newline at end of file diff --git a/_scripts/wordpress-unparse.php b/_scripts/wordpress-unparse.php deleted file mode 100644 index 6ac3330..0000000 --- a/_scripts/wordpress-unparse.php +++ /dev/null @@ -1,51 +0,0 @@ -query($sQuery)) { - echo " found match in database\n"; - foreach ($oStatement as $aRow) { - $sContents = $aRow[0]; - break; - } - $sNewFile = sprintf('%s/%s', $sNewDir, $sBasename); - $sNewContents = '---' . "\n" . yamlDump($aYaml) . '---' . "\n" . trim($sContents); - file_put_contents($sNewFile, $sNewContents); - echo " new file saved!\n"; - } else { - echo " no match in database\n"; - } -} - -function yamlDump($aData) { - return str_replace("'", null, Yaml::dump($aData, 4, 2)); -} \ No newline at end of file