Skip to content

Instantly share code, notes, and snippets.

View dergel's full-sized avatar

Jan Kristinus dergel

View GitHub Profile
@skerbis
skerbis / Redaxo YORM Datensatz erstellen.php
Created January 16, 2017 11:57
REDAXO yForm - YORM:: Erstellen eines Datensatzes mittels Yorm
<?php
// Neuen Datensatz initialisieren
$post = rex_yform_manager_dataset::create('rex_blog_post');
// z.B.: Feld title befüllen
$post->title = 'REDAXO-Tag in Wackershofen (am Grundbach)';
// z.B.: Feld Text befüllen ...
post->text = '...';
// Speichern des Datensatzes
if ($post->save())
@diegonobre
diegonobre / symfony3-rest-api.md
Last active January 5, 2024 14:36 — forked from tjamps/README.md
Basic RESTful API with Symfony 3 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle

Basic RESTful API with Symfony 3 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle

The API we are creating in this gist will follow these rules :

  • The API only returns JSON responses
  • All API routes require authenticationu
  • Authentication is handled via OAuth2 with password Grant Type only (no need for Authorization pages and such).
  • API versioning is managed via a subdomain (e.g. v1.api.example.com)

The API will be written in PHP with the Symfony 3 framework. The following SF2 bundles are used :

@staabm
staabm / maxpostsize.php
Last active July 30, 2020 14:16
Throw error when post_max_size was reached
<?php
function checkPostSizeExceeded() {
$maxPostSize = iniGetBytes('post_max_size');
if ($_SERVER['CONTENT_LENGTH'] > $maxPostSize) {
throw new Exception(
sprintf('Max post size exceeded! Got %s bytes, but limit is %s bytes.',
$_SERVER['CONTENT_LENGTH'],
$maxPostSize
@tbaddade
tbaddade / ctypes_sort_r4.php
Last active July 30, 2020 14:03
REDAXO - Ctypes sortieren
<?php
/*
REDAXO 4.5 - Ctypes sortieren
Sortierung erfolgt mit vorangestellter Zahl beim Ctypenamen im Template.
Bspl:
01 - Inhalt
02 - rechte Spalte
<?php
// -------------------------------------------------------------
// The following functions are used to detextile html, a process
// still in development.
// By Tim Koschützki
// Based on code from www.aquarionics.com
// -------------------------------------------------------------
class html2textile {
function detextile($text) {
$text = preg_replace("/(<\/?)(\w+)([^>]*>)/e", "'\\1'.strtolower('\\2').'\\3'", $text);
@tbaddade
tbaddade / slices_sort.php
Last active July 30, 2020 14:09
REDAXO :: sortieren der Slices eines Artikels
<?php
// -------------------------------- Einstellungen
$article_id = 2; // Artikel Id
$clang = false; // Sprachen Id --------- false = aktuelle Sprache
$ctype = 0; // Ctype Id ------------ 0 = alle Ctypes
$slices_amount = 2; // Anzahl der Slices --- 0 = alle Slices