Skip to content

Instantly share code, notes, and snippets.

:atom:
coding

Sergey Mochalov proweb

:atom:
coding
Block or report user

Report or block proweb

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@proweb
proweb / gist:6c6100434e67aaa64ced
Created Jan 2, 2016 — forked from johnbillion/hierarchy.php
WordPress Template Hierarchy (as of WordPress 4.4)
View gist:6c6100434e67aaa64ced
<?php
/* WordPress Template Hierarchy as of WordPress 4.4
is_404() ---------------------------------------------------------------------------------------------------> 404.php
is_search() ------------------------------------------------------------------------------------------------> search.php
is_front_page() --------------------------------------------------------------------------------------------> front-page.php
is_home() --------------------------------------------------------------------------------------------------> home.php
@proweb
proweb / index.php
Created Nov 20, 2013
Joomla plugin event triggers
View index.php
Each plugin type has its own set of events that trigger these plugins to execute. Each plugin can use one or more event triggers but there is no need to use all the event triggers available, just pick out the ones you need. You also have the freedom to create your own custom plugin event triggers in your components, however, that is also outside the scope of this book. The following table summarizes the types of plugins available and their respective event triggers:
Plugin type Event trigger
Authentication onUserAuthenticate
onUserAuthorisationFailure
Captcha onCheckAnswer
onDisplay
onInit
@proweb
proweb / image.php
Created Aug 1, 2013
Joomla 3 thumbnails function
View image.php
/**
* Method to create thumbnails from the current image and save them to disk. It allows creation by resizing
* or croppping the original image.
*
* @param mixed $thumbSizes string or array of strings. Example: $thumbSizes = array('150x75','250x150');
* @param integer $creationMethod 1-3 resize $scaleMethod | 4 create croppping
* @param string $thumbsFolder destination thumbs folder. null generates a thumbs folder in the image folder
*
* @return array
*
@proweb
proweb / new_gist_file
Created Jun 9, 2013
How to redirect using the Joomla API
View new_gist_file
// joomla 2.5
$app = JFactory::getApplication();
$link = 'http://www.domain.com/';
$msg = 'You have been redirected to domain.com';
$app->redirect($link, $msg, $msgType='message');
@proweb
proweb / gist:4985650
Created Feb 19, 2013
Remoove Mootools for Unregistered users in Joomla
View gist:4985650
//Removing Mootools
$head = $doc->getHeadData();
//Unset Mootools for unregistered users
if($user->guest){
$head=$this->getHeadData();
reset($head['scripts']);
unset($head['scripts'][$this->baseurl . '/media/system/js/core.js']);
unset($head['scripts'][$this->baseurl . '/media/system/js/mootools.js']);
unset($head['scripts'][$this->baseurl . '/plugins/system/mtupgrade/mootools.js']);
unset($head['scripts'][$this->baseurl . '/media/system/js/mootools-core.js']);
@proweb
proweb / default.vcl
Created Nov 4, 2015 — forked from fevangelou/default.vcl_PREFACE.md
The perfect Varnish configuration for Joomla (& other CMS based) websites
View default.vcl
#################################################################################
### The perfect Varnish configuration for Joomla (& other CMS based) websites ###
#################################################################################
# USE: Place the contents of this configuration inside the main
# Varnish configuration file, located in: /etc/varnish/default.vcl (root server access required - obviously)
# IMPORTANT: The following setup assumes a 2 minute cache time. You can safely increase
# this to 5 mins for less busier sites or drop it to 1 min or even 30s for high traffic sites.
@proweb
proweb / blank-template-snippets.txt
Created Apr 11, 2012 — forked from Bloggerschmidt/template-snippets.txt
Blank Template Snippets for Joomla! 2.5
View blank-template-snippets.txt
# index.php :: load the global joomla header
# between <head> and </head>
<jdoc:include type="head" />
# index.php :: output of the system messages
# between <body> and </body>
<jdoc:include type="message" />
# index.php :: article and component output
# between <body> and </body>
@proweb
proweb / index.php
Created Jan 25, 2012
Joomla - Execute some code on home page and other code on all other pages
View index.php
<?php
//This will detect the Home Page of Joomla and perfom whatever code you tell it to
$menu = & JSite::getMenu();
if ($menu->getActive() == $menu->getDefault()) {
//This code will be executed on the home page
} else {
//This code will be executed on every page except the home page
@proweb
proweb / index.php
Created Dec 10, 2011
Правильное (последовательное) подключение мета-тегов, CSS и JS.
View index.php
<?php
defined('_JEXEC') or die;
/* The following line loads the MooTools JavaScript Library */
JHTML::_('behavior.mootools');
/* The following line gets the application object for things like displaying the site name */
$app = JFactory::getApplication();
/* Get the document object */
@proweb
proweb / default.php
Created Sep 28, 2011
Last and first classes MOD_MENU Joomla default.php
View default.php
// Copy /modules/mod_menu/tmpl/default.php to /templates/MYTEMPLATE/html/mod_menu/default.php
// Around line 34, find:
if ($item->deeper) {
$class .= 'deeper ';
}
// Replace this with:
$currentitemcount ++;
You can’t perform that action at this time.