Skip to content

Instantly share code, notes, and snippets.

@nateabele
nateabele / action.php
Last active December 17, 2015 20:28
Example of configuring `li3_resources` queries to automatically extract values from request parameters, with fallbacks to default values. **Note:** exposing elements of a query to arbitrary input (i.e., high query limits) is not advisable. The needs and context of the application should always be considered, and input should be filtered and/or s…
<?php
/**
* Snippet extracted from `config/bootstrap/action.php`.
*/
/**
* ## Mapping HTTP Request Parameters to Query Parameters
*
* The `$replacer` function is used by the `Resources` filter below to allow resource classes to
* automatically map values from the `Request` object in their query configurations.
@Maksold
Maksold / local.xml
Last active May 28, 2021 20:02
#magento #xml - local.xml boilerplate
<?xml version="1.0"?>
<layout>
<default>
<!--Root/Default Layouts-->
<reference name="root">
<!--Appending Block-->
<block type="page/html_breadcrumbs" name="breadcrumbs" as="breadcrumbs"/>
</reference>
<!--CSS and JS Files-->
@nateabele
nateabele / Base.php
Created September 19, 2012 21:53
MongoDB-based model accessors (relationships) in Lithium
<?php
namespace my_app\models;
use MongoId;
use lithium\data\collection\DocumentArray;
use lithium\data\collection\DocumentSet;
use lithium\data\entity\Document;
use lithium\util\Inflector;
use lithium\core\Libraries;
@Adirael
Adirael / fix-wordpress-permissions.sh
Created August 17, 2012 23:16
Fix wordpress file permissions
#!/bin/bash
#
# This script configures WordPress file permissions based on recommendations
# from http://codex.wordpress.org/Hardening_WordPress#File_permissions
#
# Author: Michael Conigliaro <mike [at] conigliaro [dot] org>
#
WP_OWNER=www-data # <-- wordpress owner
WP_GROUP=www-data # <-- wordpress group
WP_ROOT=$1 # <-- wordpress root directory
@nateabele
nateabele / routes.php
Last active June 16, 2017 13:05
Lithium continuation route examples
<?php
/**
* Continuation routing examples. Handles URLs in the following forms:
*
* /posts
* /en/posts
* /admin/posts
* /admin/en/posts
* /admin/en/posts.json
* /admin/en/posts/4ef16ccc7f8b9aa331000064.json
@fahad19
fahad19 / Navigation.php
Created November 23, 2011 02:34
Admin navigation management in Lithium PHP framework
<?php
/**
* Navigation class for storing admin panel menu.
*
* @author Fahad Ibnay Heylaal <contact@fahad19.com>
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
namespace core\storage;
use core\util\Set;