Skip to content

Commit

Permalink
Init
Browse files Browse the repository at this point in the history
  • Loading branch information
dignajar committed Jan 17, 2018
0 parents commit 091bef8
Show file tree
Hide file tree
Showing 15 changed files with 586 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
metadata/*
.DS_Store
135 changes: 135 additions & 0 deletions config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
<?php
define('BLUDIT', true);
define('DS', DIRECTORY_SEPARATOR);
define('PATH_ROOT', __DIR__.DS);
define('PATH_PHP', PATH_ROOT.'php'.DS);
define('PATH_METADATA', PATH_ROOT.'metadata'.DS);
define('CHARSET', 'UTF-8');
define('DOMAIN', 'http://localhost:8000');
#define('DOMAIN', 'https://plugins.bludit.com');
define('CDN', 'http://localhost:8000/metadata/');
#define('CDN', 'https://rawgit.com/bludit/plugins-repository/master/');

// Returns the translation of the key
function l($key, $print=true) {
global $languageArray;
$key = mb_strtolower($key, CHARSET);
$key = str_replace(' ','-',$key);
if (isset($languageArray[$key])) {
if ($print) {
echo $languageArray[$key];
} else {
return $languageArray[$key];
}
}
}

function buildItem($data, $filename) {
global $currentLanguage;
global $_topbar;

$data['filename'] = $filename;
$data['screenshoot_url'] = CDN.$data['filename'].'/screenshot800x600.png';
$data['screenshoot_twitter_url'] = CDN.$data['filename'].'/screenshot800x600.png';
$data['screenshoot_facebook_url'] = CDN.$data['filename'].'/screenshot800x600.png';
$data['permalink'] = $_topbar['website'].'/plugin/'.$filename;
if (isset($data['description_'.$currentLanguage])) {
$data['description'] = $data['description_'.$currentLanguage];
}
if (isset($data['features_'.$currentLanguage])) {
$data['features'] = $data['features_'.$currentLanguage];
}
return $data;
}

// Returns the items order by date, new to old.
function getItems() {
$tmp = array();
$it = new RecursiveDirectoryIterator(PATH_METADATA);
foreach (new RecursiveIteratorIterator($it) as $file) {
if ($file->getExtension()=='json') {
$json = file_get_contents($file);
$data = json_decode($json, true);
$item = buildItem($data, pathinfo($file, PATHINFO_FILENAME));
array_push($tmp, $item);
}
}
// Sort by date
usort($tmp, "sortByDate");
return $tmp;
}

function getItem($filename) {
$metadataFile = PATH_METADATA.$filename.DS.'metadata.json';

if (!file_exists($metadataFile)) {
return false;
}

$json = file_get_contents($metadataFile);
$data = json_decode($json, true);
$item = buildItem($data, $filename);

return $item;
}

function sortByDate($a, $b) {
if ($a['release_date'] == $b['release_date']) {
return 0;
}
return ($a['release_date'] > $b['release_date']) ? -1 : 1;
}

function sanitize($string) {
$string = str_replace(' ', '-', $string);
return preg_replace('/[^A-Za-z0-9\-]/', '', $string);
}

// Language passed via $_GET['l']
$currentLanguage = 'en';
$acceptedLanguages = array('en', 'de', 'es');
if (isset($_GET['l'])) {
if (in_array($_GET['l'], $acceptedLanguages)) {
$currentLanguage = $_GET['l'];
}
}

$json = file_get_contents(PATH_ROOT.'languages'.DS.$currentLanguage.'.json');
$languageArray = json_decode($json, true);

// Top bar links
if ($currentLanguage !== "en") {
$_topbar = array(
'documentation'=>'https://docs.bludit.com/'.$currentLanguage.'/',
'themes'=>'https://themes.bludit.com/'.$currentLanguage.'/',
'plugins'=>'https://plugins.bludit.com/'.$currentLanguage.'/',
'pro'=>'https://pro.bludit.com/'.$currentLanguage.'/',
'website'=>DOMAIN.'/'.$currentLanguage.'/'
);
} else {
$_topbar = array(
'documentation'=>'https://docs.bludit.com',
'themes'=>'https://themes.bludit.com',
'plugins'=>'https://plugins.bludit.com',
'pro'=>'https://pro.bludit.com',
'website'=>DOMAIN
);
}

// Items and Item passed via $_GET['item']
$_items = false;
$_item = false;
$_whereAmI = 'home';

if (!empty($_GET['item'])) {
$itemName = sanitize($_GET['item']);
$_item = getItem($itemName);
$_whereAmI = 'item';
if ($_item===false) {
header("HTTP/1.0 404 Not Found");
exit;
}
} else {
$_items = getItems();
$_whereAmI = 'home';
}
67 changes: 67 additions & 0 deletions css/bludit.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
body {
padding-top: 54px;
font-family: 'Open Sans', sans-serif;
background: #f1f1f1;
}

@media (min-width: 992px) {
body {
padding-top: 56px;
}
}

a {
color: #333;
}

.item {
margin-bottom: 80px;
padding-right: 45px;
padding-left: 45px;
}

.card-title {
font-weight: normal;
text-transform: uppercase;
}

.card-subtitle {
font-size: 0.9em;
color: #888;
}

.nav-link {
font-size: 0.8em;
text-transform: uppercase;
}

footer {
font-size: 0.8em;
}

ul.features {
font-size: 0.9em;
}

ul.features > li {
margin-bottom: 10px;
}

a.author-social {
font-size: 1.5em;
color: #888;
margin-right: 5px;
}

a.author-social:hover {
color: #555;
}

.btn {
padding: 5px 13px;
background: linear-gradient(to bottom,#90a4ae 0,#78909c 100%);
}

.btn-primary {
background: linear-gradient(to bottom,#42a5f5 0,#2196f3 100%);
}
13 changes: 13 additions & 0 deletions img/bludit-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 26 additions & 0 deletions index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php include('config.php'); ?>
<!DOCTYPE html>
<html>
<?php include(PATH_PHP.'head.php'); ?>
<body>
<!-- Top Bar -->
<?php include(PATH_PHP.'topnavbar.php'); ?>

<!-- Main -->
<?php
if ($_whereAmI==='item') {
include(PATH_PHP.'item.php');
} else {
include(PATH_PHP.'home.php');
}
?>

<!-- Footer -->
<?php include(PATH_PHP.'footer.php'); ?>

<!-- Javascript stuff -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.3/js/bootstrap.bundle.min.js"></script>

</body>
</html>
26 changes: 26 additions & 0 deletions languages/de.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"head-title": "Plugins | Bludit",
"head-description": "Erweitere die Funktionalität von Bludit mit einmaligen Plugins. HTML-Editoren, CSS-Anpassung, RSS-Feed, Sitemap, Open Graph, Twitter Cards und mehr.",
"little-description-paragraph1": "<b>Erweitere</b> die Funktionalität von Bludit mit <b>einmaligen</b> Plugins",
"add-new-plugin": "Add New Plugin",

"demo": "Demo",
"documentation": "Dokumentation",
"themes": "Themes",
"plugins": "Plugins",
"donations": "Spenden",
"donate": "Spenden",
"download": "Download",
"search": "Suche",
"live-demo": "Live Demo",
"free-download": "Free Download",
"more-information": "More information",
"made-by": "Made by",
"support-forum": "Support Forum",
"support-chat": "Support Chat",
"description": "Description",
"features": "Features",
"last-update": "Last update",
"author": "Author",
"buy": "Buy"
}
26 changes: 26 additions & 0 deletions languages/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"head-title": "Plugins | Bludit",
"head-description": "Extend Bludit functionality with amazing plugins. Social networks, HTML Editors, Customize CSS, RSS Feed, Sitemap, Open Graph, Twitter Cards, and more.",
"little-description-paragraph1": "<b>Extend</b> Bludit functionality with <b>amazing</b> plugins",
"add-new-plugin": "Add New Plugin",

"demo": "Demo",
"documentation": "Documentation",
"themes": "Themes",
"plugins": "Plugins",
"donations": "Donaciones",
"donate": "Donate",
"download": "Download",
"search": "Search",
"live-demo": "Live Demo",
"free-download": "Free Download",
"more-information": "More information",
"made-by": "Made by",
"support-forum": "Support Forum",
"support-chat": "Support Chat",
"description": "Description",
"features": "Features",
"last-update": "Last update",
"author": "Author",
"buy": "Buy"
}
26 changes: 26 additions & 0 deletions languages/es.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"head-title": "Plugins | Bludit",
"head-description": "Amplíe la funcionalidad de Bludit con increíbles plugins. Redes sociales, editores HTML, RSS Feed, Sitemap, Open Graph, Twitter Cards, y mucho más.",
"little-description-paragraph1": "<b>Amplíe</b> las funcionalidades de Bludit con <b>increíbles</b> plugins",
"add-new-plugin": "Add New Plugin",

"demo": "Demo",
"documentation": "Documentation",
"themes": "Themes",
"plugins": "Plugins",
"donations": "Donaciones",
"donate": "Donate",
"download": "Download",
"search": "Search",
"live-demo": "Live Demo",
"free-download": "Free Download",
"more-information": "More information",
"made-by": "Made by",
"support-forum": "Support Forum",
"support-chat": "Support Chat",
"description": "Description",
"features": "Features",
"last-update": "Last update",
"author": "Author",
"buy": "Buy"
}
1 change: 1 addition & 0 deletions metadata
Submodule metadata added at 330541
33 changes: 33 additions & 0 deletions php/footer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php defined('BLUDIT') or die('Bludit'); ?>
<footer class="py-4 bg-dark">
<div class="container">
<div class="row mb-2">
<div class="col-6">

</div>
<div class="col-6 text-right">
<a class="text-white" href="https://plugins.bludit.com">English</a>
<span class="text-muted"> | </span>
<a class="text-white" href="https://plugins.bludit.com/de/">Deutsch</a>
<span class="text-muted"> | </span>
<a class="text-white" href="https://plugins.bludit.com/es/">Español</a>
</div>
</div>
<div class="row">
<div class="col-6">
<a class="text-white" href="<?php echo $_topbar['website'] ?>">Bludit Plugins</a>
<span class="text-muted">© 2018</span>
</div>
<div class="col-6 text-right">
<a class="text-white" href="https://www.bludit.com">Bludit</a>
<span class="text-muted"> | </span>
<a class="text-white" href="https://forum.bludit.org"><?php l('Support Forum') ?></a>
<span class="text-muted"> | </span>
<a class="text-white" href="https://gitter.im/bludit/support"><?php l('Support Chat') ?></a>
<span class="text-muted"> | </span>
<a class="text-white" href="https://github.com/bludit/plugins-repository"><?php l('Add New Plugin') ?></a>
</div>
</div>

</div>
</footer>
Loading

0 comments on commit 091bef8

Please sign in to comment.