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 / router.php
Created Feb 2, 2013
K2 Router (without "item" in URL)
View router.php
<?php
/**
* @version $Id: router.php 1618 2012-09-21 11:23:08Z lefteris.kavadas $
* @package K2
* @author JoomlaWorks http://www.joomlaworks.net
* @copyright Copyright (c) 2006 - 2012 JoomlaWorks Ltd. All rights reserved.
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
*/
// no direct access
@proweb
proweb / gist:31f3c78ef08e4c86f1d10dbc6d352b21
Created May 19, 2017 — forked from dmitrymomot/gist:4654524
Получение в jquery get-параметра с url страницы
View gist:31f3c78ef08e4c86f1d10dbc6d352b21
// получаем URL параметры
// var allVars = $.getUrlVars();
// получаем значение параметра по его имени
// var byName = $.getUrlVar('name');
$.extend({
getUrlVars: function(){
var vars = [], hash;
@proweb
proweb / json.php
Created Aug 14, 2013
Best way for JSON output in Joomla controller
View json.php
class MyController extends JController
{
function someTask()
{
// Get the application object.
$app = JFactory::getApplication();
// Get the model.
$model = $this->getModel('MyModel');
@proweb
proweb / d7_function.php
Created May 9, 2017
Drupal 7 - remove shortlink, rel=alternate and generator meta tag
View d7_function.php
function themename_html_head_alter(&$head_elements) {
foreach ($head_elements as $key => $element) {
if (isset($element['#attributes']['rel']) && $element['#attributes']['rel'] == 'shortlink') {
unset($head_elements[$key]);
}
if (isset($element['#attributes']['rel']) && $element['#attributes']['rel'] == 'alternate') {
unset($head_elements[$key]);
}
}
unset($head_elements['system_meta_generator']);
@proweb
proweb / functions.php
Last active May 7, 2017
Wordpress. Function for remove archive prefix from archive title. Remove “Category:”, “Tag:”, “Author:” from the_archive_title.
View functions.php
function remove_category_prefix_from_archive_title( $title ) {
if ( is_category() ) {
$title = single_cat_title( '', false );
} elseif ( is_tag() ) {
$title = single_tag_title( '', false );
} elseif ( is_author() ) {
$title = '<span class="vcard">' . get_the_author() . '</span>' ;
}
View .gitignore
# -----------------------------------------------------------------
# .gitignore for WordPress @salcode
# ver 20160309
#
# From the root of your project run
# curl -O https://gist.githubusercontent.com/salcode/b515f520d3f8207ecd04/raw/.gitignore
# to download this file
#
# By default all files are ignored. You'll need to whitelist
# any mu-plugins, plugins, or themes you want to include in the repo.
@proweb
proweb / post_format_icon.php
Created Feb 15, 2017 — forked from smutek/post_format_icon.php
Function for Post Format icons
View post_format_icon.php
<?php
/**
* Output Post Format icons
*
* Outputs an icon for each post format. Set up to use Fontawesome,
* but can be used with anything, or you can just use CSS.
*
* @return string
*/
function post_format_icon() {
@proweb
proweb / modificator.xml
Created Dec 20, 2016
Модифицируем заголовок модуля Рекомендуемые (Featured) в Opencart. Заголовок берется из настроек самого модуля
View modificator.xml
<?xml version="1.0" encoding="utf-8"?>
<modification>
<name>Featured module name replace</name>
<code>featuredmodulenamebyagatha65</code>
<version>1.0</version>
<author>agatha65.com</author>
<link>http://agatha65.com/services/opencart-extensions</link>
<file path="catalog/controller/extension/module/featured.php">
<operation>
@proweb
proweb / category.php
Created Jul 24, 2016
JBZOO category template (/media/zoo/applications/jbuniversal/templates/uikit/category.php)
View category.php
if (isset($category)) {
$cat_name = $category->name;
$cat_alias = $category->alias;
$cat_description = $category->description;
$cat_alter_name = $category->params->get('content.category_title');
$cat_subtitle = $category->params->get('content.category_subtitle');
$cat_teasertext = $category->params->get('content.category_teaser_text');
}
@proweb
proweb / index.php
Created Jun 16, 2013
Easy PHP localhost landing page
View index.php
<!DOCTYPE html>
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
<title>localhost</title>
</head>
<body>
<h1>It Works!</h1>
<ul>
<?php
You can’t perform that action at this time.