Skip to content

Instantly share code, notes, and snippets.

View thomaslarsson's full-sized avatar

Thomas Maurstad Larsson thomaslarsson

View GitHub Profile
@thomaslarsson
thomaslarsson / functions_posting.php
Created April 2, 2014 17:57
Funksjon for dumping av tråder
/**
* Handle topic bumping
* @param int $forum_id The ID of the forum the topic is being bumped belongs to
* @param int $topic_id The ID of the topic is being bumping
* @param array $post_data Passes some topic parameters:
* - 'topic_title'
* - 'topic_last_post_id'
* - 'topic_last_poster_id'
* - 'topic_last_post_subject'
* - 'topic_last_poster_name'
@thomaslarsson
thomaslarsson / thai.php
Created October 9, 2014 14:21
Thai logic
<?php
interface Same {
const SAME_BUT_DIFFERENT = "yes";
const SAME = "yes";
public function same($same);
}
class Thailand implements Same
@thomaslarsson
thomaslarsson / mapper.php
Created October 23, 2014 12:51
Google shop mapper
...
use eZ\Publish\Core\MVC\Legacy\Kernel as LegacyKernel;
use \eZURI;
class GoogleApiMapperService {
/** @var eZLegacyKernel */
protected $legacyKernel;
<?php
namespace NM\Bundle\GoogleProductsBundle\API;
use eZ\Publish\API\Repository\Values\Content\Query\Criterion;
use eZ\Publish\API\Repository\Values\Content\Query;
use eZ\Publish\Core\MVC\Legacy\Kernel as LegacyKernel;
use eZContentObjectTreeNode;
/**
* Class eZProductSearchService
@thomaslarsson
thomaslarsson / purgeOldTrash
Last active August 29, 2015 14:23
place in extension/x/bin/php/purgeOldCache.php. Change dir to ezpublish_legacy and run using $ php extension/x/bin/php/purgeOldCache.php.
<?php
require_once('autoload.php');
// Configuration
$removeOlderThanDays = 90;
$siteaccess = "admin_siteaccess";
// CLI initialization.
$cli = eZCLI::instance();
@thomaslarsson
thomaslarsson / gist:3122868
Created July 16, 2012 13:58
User-Member composition illustration with print_r()
User object
{
private user_id = 1;
private user_email = 'thomas@juvenorge.com';
private user_access_key 'ergdvzwezsfgdzesgeszwsfd';
private user_access_level = '1'; // Administrator
private user_last_active '2012/07/16 16:00';
private member = Member object {
private member_id = 1; // Could be 2, 5, 72, etc
private date_of_registration = ''; // some date
@thomaslarsson
thomaslarsson / user_member.php
Created July 18, 2012 02:45
User-Member composition illustration with code
<?php
class User
{
private $user_id;
private $user_email;
private $password;
private $user_access_key;
private $user_access_level;
private $user_last_active;
@thomaslarsson
thomaslarsson / skeletons.php
Created July 19, 2012 15:49
User, Model_User, Hash and Session class skeletons
<?php
/**
* User class
*/
class User
{
/**
@thomaslarsson
thomaslarsson / dump
Created August 6, 2012 16:20
Groups, Users, Group members and Memberships
prefix_access_levels
--------------------------
access_level_id INT(2)
level TINYINT(1)
name VARCHAR(255)
prefix_groups
--------------------------
group_id INT(2)
@thomaslarsson
thomaslarsson / Database.php
Created August 10, 2012 23:26
Improved Database wrapper
<?php
/**
* Database
*
* Database library using MySQLi.
*
* @package Core
* @author Lasse Brenden <lasse@pelota.no>
* @copyright (c)2012, Pelota