Skip to content

Commit

Permalink
Changed version_id scheme
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshyPHP committed Nov 2, 2013
1 parent c250836 commit e226668
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion build/addon.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<addon addon_id="s9e" title="s9e Media Pack" url="https://github.com/s9e/XenForoMediaBBCodes" version_id="20131101b" version_string="20131101b" install_callback_class="s9e_MediaBBCodes" install_callback_method="install">
<addon addon_id="s9e" title="s9e Media Pack" url="https://github.com/s9e/XenForoMediaBBCodes" version_id="20131102" version_string="201311020" install_callback_class="s9e_MediaBBCodes" install_callback_method="install">
<bb_code_media_sites>
<site media_site_id="bandcamp" site_title="Bandcamp" site_url="http://bandcamp.com/" match_is_regex="1" embed_html_callback_class="s9e_MediaBBCodes" embed_html_callback_method="embed" match_callback_class="s9e_MediaBBCodes" match_callback_method="matchBandcamp">
<match_urls>!bandcamp\.com/album/.!
Expand Down
16 changes: 13 additions & 3 deletions scripts/build.php
Expand Up @@ -238,18 +238,20 @@ protected static function getNamedCaptures($string, $regexps)

// The version is simply the current UTC day, optionally followed by the first argument given to
// this script
$versionId = gmdate('Ymd');
$version = gmdate('Ymd');
$versionId = $version * 10;
if (isset($_SERVER['argv'][1]))
{
$versionId .= $_SERVER['argv'][1];
$version .= $_SERVER['argv'][1];
$versionId += ord($_SERVER['argv'][1]) - 97;
}

// Set the add-on informations
$attributes = [
'addon_id' => 's9e',
'title' => 's9e Media Pack',
'url' => 'https://github.com/s9e/XenForoMediaBBCodes',
'version_id' => $versionId,
'version_id' => $version,
'version_string' => $versionId,
'install_callback_class' => 's9e_MediaBBCodes',
'install_callback_method' => 'install'
Expand Down Expand Up @@ -281,6 +283,14 @@ protected static function getNamedCaptures($string, $regexps)
$node->setAttribute('site_url', $site->homepage);
$node->setAttribute('match_is_regex', '1');

preg_match_all('/(?<=@)\\w+/', $template, $matches);
$attrNames = array_unique($matches[0]);

if (count($attrNames) === 1 && $attrNames !== ['id'])
{
die("Remap $site[id]\n");
}

// Default HTML replacement. Ensure that iframe and script have an end tag
$html = preg_replace('#(<(iframe|script)[^>]+)/>#', '$1></$2>', $template);

Expand Down

0 comments on commit e226668

Please sign in to comment.