Skip to content

Instantly share code, notes, and snippets.

View jeroendesloovere's full-sized avatar

Jeroen Desloovere jeroendesloovere

View GitHub Profile
@jeroendesloovere
jeroendesloovere / sitemap_generator.php
Last active July 13, 2018 09:06
Sitemap generator: new version
<?php
/**
* NOTE: the code below was a brainstorm session.
* You should check out https://github.com/jeroendesloovere/sitemap-bundle for the latest code
*/
/**
* CORE
*/
@jeroendesloovere
jeroendesloovere / translation_helper.php
Created March 13, 2018 09:32 — forked from ohvitorino/translation_helper.php
ForkCMS translation helper.
<?php
$document = new DOMDocument();
$document->load($argv[1]);
$existingTranslations = [];
function getUserInput() {
return readline("\nTranslation PT: ");
}
@jeroendesloovere
jeroendesloovere / fork_cms_core_rules.md
Last active February 27, 2018 13:57
Fork CMS core rules

Fork CMS core rules

PHP

  • Vendor namespace ForkCMS
  • We follow the PSR-2 coding style guide
  • Class names in PascalCase, f.e.: class Url{}, class FirstName{} - All abbreviations need to be PascalCased
  • Method names in camelCase, f.e.: function getUrl(){}, function getFirstName(){}- All abbreviations need to be camelCased

Symfony service-ids

@jeroendesloovere
jeroendesloovere / structure.md
Last active February 6, 2018 16:32
Fork CMS structure
- src
  - Console
    - Core
    - Locale
    - Thumbnails
  - Component
    - Asset
      - Asset.php
      - AssetCollection.php
@jeroendesloovere
jeroendesloovere / MediaLibraryImporter.md
Created April 11, 2017 15:47
MediaLibraryImporter module

MediaLibraryImporter

/**

  • Creating */

// Creating the media group

@jeroendesloovere
jeroendesloovere / README.md
Last active March 10, 2017 16:35
MediaLibrary + external Amazon, Dropbox, ...

Fork CMS MediaLibrary module + external storage type (Amazon, Dropbox, ...)

The idea

Backend thumbnails

What happens in the MediaLibrary module

When somebody uploads a source to the website. => A MediaItemCreated event is triggered.

@jeroendesloovere
jeroendesloovere / doctrine-reverse-engineering.md
Created December 30, 2016 09:58
Reverse engineering doctrine

Doctrine Reverse Engineering

Doctrine Source

How to create Entity files from database tables?

1. Creating .orm.yml files in /Resources/config/...

php app/console doctrine:mapping:import --force AcmeBlogBundle yml --env=prod
@jeroendesloovere
jeroendesloovere / php-cs-fixer.md
Created December 16, 2016 14:34
php-cs-fixer

PHP-CS-FIXER

This tool checks for PSR code styling. More info

Usage

Installation

We download it to /usr/local/bin/

@jeroendesloovere
jeroendesloovere / DataGridDoctrine.php
Last active October 26, 2016 11:58
Datagrid + Doctrine
<?php
// Filename: src/Backend/Core/Engine/DataGridDoctrine.php
namespace Backend\Core\Engine;
/*
* This file is part of Fork CMS.
*
* For the full copyright and license information, please view the license
* file that was distributed with this source code.
*/
<?php
// Backend MediaGroups Helper
$this->media = $this->get('media_library.helper.backend')->create(
$this->frm,
$this->tpl,
$this->header,
array(
// create new with specified MediaGroup type
$this->get('media_library.factory.backend.group')->create(