Skip to content

Instantly share code, notes, and snippets.

View RaymondBenc's full-sized avatar

Raymond Benc RaymondBenc

View GitHub Profile
@RaymondBenc
RaymondBenc / gist:9132634
Created February 21, 2014 11:17
Convert all images in a folder using mogrify
mogrify -path /new-path -resize 16x16 /path-to-images-to-resize/*
@RaymondBenc
RaymondBenc / sample-app.php
Created March 11, 2014 13:45
Sample M9 App
<m:h1>Example Page</m:h1>
My Image:<br />
<m:image />
<br />
My Name: <m:name />
<br />
My Friends: <m:friends />
<?php
namespace M9;
(new Test(function(M9Test $tester) {
if ($tester->is_logged_in()){
$tester->log_out();
$tester->log_in_as("normal");
}
}));
<?php
namespace M9;
class Test {
function __construct($function) {
$object = new M9Test();
$return = call_user_func($function, $object);
}
}
@RaymondBenc
RaymondBenc / create-app
Last active August 29, 2015 14:02
Create an App in phpMyAdmin
1) Open table "phpfox_app"
2) Insert your App
3) Add custom JSON in the "data" column
Example to add to the <header>...
{"header":"<script>alert('Hello World');</script>"}
Example to add to the end of the HTML body...
{"footer":"<script>alert('Hello World');</script>"}
@RaymondBenc
RaymondBenc / grab.class.php
Last active August 29, 2015 14:21
YouTube Device Support fix for PHPfox v3
# file: /module/video/include/service/grab.class.php
# Look for:
if (strpos($sUrl, 'youtube') || (preg_match('/http:\/\/youtu\.be\/(.*)/i', $sUrl, $aMatches) && isset($aMatches[1])))
{
$this->_aRegex = false;
$this->_aSites = $this->_aSiteCache;
if (isset($aMatches) && $aMatches[1])
{
$sUrl = 'http://www.youtube.com/watch?v=' . $aMatches[1];
@RaymondBenc
RaymondBenc / .htaccess
Created May 27, 2015 14:57
PHPfox v4 .htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^static/ajax.php index.php
RewriteRule ^themes/default/(.*) PF.Base/theme/default/$1
RewriteRule ^(file|static|theme|module)/(.*) PF.Base/$1/$2
RewriteRule ^(apps|themes)/(.*) PF.Site/$1/$2
RewriteCond %{REQUEST_FILENAME} !-f
# START PHPfox Rewrite
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(file)/(.*) PF.Base/$1/$2
RewriteRule ^static/ajax.php index.php
RewriteRule ^themes/default/(.*) PF.Base/theme/default/$1
<?php
$callback = function(Core\Block $block) {
return 'Hello!';
};
new Core\Block('/hello-world', 1, $callback);
new Core\Block('/core.index-member', 1, $callback);
<?php
$block = function(Core\Block $block) {
$is = new Core\Is();
$menus = [
[
'module' => 'pages',
'perm' => 'pages.can_view_browse_pages',
'phrase' => 'Pages or Groups',