Skip to content

Instantly share code, notes, and snippets.

/* scroll to top buttton */
a.scrollToTop{
width:75px;
height:75px;
text-align:center;
background: whiteSmoke;
text-decoration: none;
position:fixed;
bottom:30px;
right:30px;
@AlexMcowkin
AlexMcowkin / php_get_full_root_path.php
Created March 20, 2015 11:28
PHP get full root path for config files
<?php
echo getcwd();
?>
@AlexMcowkin
AlexMcowkin / my_git_github_list_commands
Created March 24, 2015 14:48
Git/github list commands
// ----------глобальные настроики---------
git config --global user.name "alexandr makovkin"
git config --global user.email "info@makovkin.com"
git config --global core.editor "notepad.exe -wl1"
git config --global color.ui true
// ---------пльзовательские настроики---------
git config user.name "alexandr makovkin"
git config user.email "info@makovkin.com"
git config core.editor "notepad.exe -wl1"
@AlexMcowkin
AlexMcowkin / wp_protection
Created March 25, 2015 16:03
WP protection
Вы можете запретить редактирование файлов в панели администрирования с помощью константы в конфигурационном файле WordPress
wp-config.php:
define( 'DISALLOW_FILE_EDIT', true );
Учтите, что установив эту директиву вы больше не сможете устанавливать и обновлять темы и плагины через панель администратора. Вам придётся это делать вручную с помощью FTP или SSH.
define( 'DISALLOW_FILE_MODS', true );
Плагин Exploit Scanner позволит просканировать ваш WordPress на вредоносные скрипты, плагины и темы.
@AlexMcowkin
AlexMcowkin / wp_shortcodes_with_params
Last active August 29, 2015 14:17
WP shortcodes: with params
<?php
// в посте добавить
[shortcodeName user="Alex" login="Phpist85"]
// в файле functions.php
function fncName($atrs)
{
$user = isset($atrs['user']) ? $atrs['user'] : 'EmptyUser'
$login = isset($atrs['login']) ? $atrs['login'] : 'EmptyLogin'
@AlexMcowkin
AlexMcowkin / wp_shortcodes_with_content
Last active August 29, 2015 14:17
WP shortcodes: with content
<?php
// в посте добавить
[shortcodeName]Some content here[/shortcodeName]
// в файле functions.php
function fncName($atrs, $content)
{
$content = !empty($content) ? $content : 'No content'
//body
@AlexMcowkin
AlexMcowkin / php_remove_line_breaks_and_tabulation
Last active August 29, 2015 14:18
PHP remove line breaks and tabulation
<?php
// remove line breaks
$_descr = str_replace(array("\r\n", "\r", "\n"), "", $_descr);
// remove tabulation
$_descr = preg_replace('/\t+/', '', $_descr);
// $xmlString = rtrim($xmlString, "\r\n");
// $xmlString = rtrim($xmlString, "\r");
// $xmlString = rtrim($xmlString, "\n");
@AlexMcowkin
AlexMcowkin / git_base_commands
Created April 1, 2015 05:09
GIT base commands
// ----------глобальные настроики---------
git config --global user.name "alexandr makovkin"
git config --global user.email "info@makovkin.com"
git config --global core.editor "notepad.exe -wl1"
git config --global color.ui true
// ---------пльзовательские настроики---------
git config --global user.name "alexandr makovkin"
git config --global user.email "info@makovkin.com"
git config --global core.editor "notepad.exe -wl1"
@AlexMcowkin
AlexMcowkin / codeigniter_switch_encironment
Created April 7, 2015 13:39
CODEIGNITER: switch ENVIRONMENT
<?php
switch($_SERVER["HTTP_HOST"])
{
case "makovkin.info": define('ENVIRONMENT', 'production');
break;
case "makovkin.loc": define('ENVIRONMENT', 'development');
break;
default: define('ENVIRONMENT', 'development');
break;
}
@AlexMcowkin
AlexMcowkin / js_sitename
Created April 21, 2015 21:55
JS: get sitename
// http://sitename.com
var sitename = location.protocol + '//' + location.hostname;