Skip to content

Instantly share code, notes, and snippets.

View jreviews's full-sized avatar

JReviews jreviews

View GitHub Profile
@jreviews
jreviews / field_phpformat_claim_and_write_review.php
Created November 14, 2019 00:17
JReviews banner custom field PHP Format to output Claim and Write Review button
if ( defined('MVC_FRAMEWORK_ADMIN') ) return false;
$listingHelper = ClassRegistry::getClass('ListingHelperHelper');
$routesHelper = ClassRegistry::getClass('RoutesHelper');
ob_start();
$claim = $listingHelper->claim($entry);
$claimButton = ob_get_clean();
<?php
defined('MVC_FRAMEWORK') or die;
function antispam_filter($validation, $params)
{
$files = glob(__DIR__.DS.'spamlists/*.conf');
$list = '';
foreach ($files as $file)
<?php
defined('MVC_FRAMEWORK') or die;
require dirname(dirname(__FILE__)).DS.'filters/stripe_config.php';
DeveloperController::macro('stripe_checkout', function() use ($stripe_config)
{
$config = $stripe_config;
$client = new \GuzzleHttp\Client();
@jreviews
jreviews / listing_search_minimum_characters.php
Created November 16, 2019 11:21
JReviews Developer Filter: Change the minimum word length requirement for searches
<?php
defined('MVC_FRAMEWORK') or die;
/**
* Change the minimum word length requirement for a word to be included in a keyword search
*/
function listing_search_minimum_characters($request, $params)
{
ListingsRepositoryComponent::$min_word_chars = 2;
@jreviews
jreviews / google_api_listing_form_only.php
Created November 8, 2019 11:41
JReviews Developer Filter: Limit loading of Google Maps API in front-end to the listing form
<?php
defined('MVC_FRAMEWORK') or die;
/**
* In front-end, load Google Maps API only while using the listing form
* if either the map service or geocoding service is set to Google
*/
function google_api_listing_form_only($load, $params)
{
if ( $params['in_admin'] )
@jreviews
jreviews / hide_detail_page_map.php
Last active November 18, 2019 13:21
JReviews Developer Filter: Hide detail page map when street address is missing
<?php
defined('MVC_FRAMEWORK') or die;
/**
* Hide map in detail page when the listing doesn't have a street address
*/
function hide_map_noaddress($viewVars, $params)
{
$controller = $params['controller'];
@jreviews
jreviews / custom.css
Last active November 18, 2019 21:54
iReview dropdown menu animation - creates a fade in and fade out effect for the horizontal dropdown menu
.menu-horizontal .submenu:not(.menu-module) {
display: block;
}
.menu-horizontal.dropdown-hover .dropdown > .submenu {
visibility: hidden;
opacity: 0;
max-height: 0;
transition-duration: 0.5s;
}
@jreviews
jreviews / custom.css
Last active November 19, 2019 19:19
iReview sticky menu
.floating-menu {
position: fixed;
top: 40px; /*adjustment for existing top-bar module, so the menu stacks below it*/
left: 0;
right: 0;
width: 100%;
z-index: 1;
}
@jreviews
jreviews / custom.css
Created November 20, 2019 18:07
iReview sticky menu - centered
.floating-menu {
position: fixed;
top: 40px; /*adjustment for existing top-bar module, so the menu stacks below it*/
left: 0;
right: 0;
width: 100%;
z-index: 1;
}
.moduleid-269 .menu-horizontal {
@jreviews
jreviews / custom_import_controller.php
Last active November 22, 2019 19:21
Programmatically import photos using Import Add-on classes
<?php
defined('MVC_FRAMEWORK') or die;
S2App::import('Model',['everywhere_com_content','import_listing'],'jreviews');
S2App::import('Component','import_photo_helper','jreviews');
class CustomImportController extends MyController {
var $uses = ['Media'];