This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Request wrapper for API AmoCRM | |
*/ | |
function wooac_request($ep = '', $method = 'GET', $data = array()) | |
{ | |
try { | |
$cookies = get_transient('wooac_cookies'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* If isset cookie - clear value and redirect to url | |
*/ | |
function redirect_after_signin(){ | |
if(is_user_logged_in()){ | |
if( ! empty($_COOKIE["redirect_url_sso"])){ | |
$url = $_COOKIE["redirect_url_sso"]; | |
setcookie("redirect_url_sso", "", time() - 3600); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: Gutenberg - disable CPT | |
Description: Отключаем поддержку Gutenberg для постов типа Продукт | |
Author: uptimizt | |
Version: 1.0 | |
Author URI: http://wpcraft.ru | |
*/ | |
// Use hook return apply_filters( 'gutenberg_can_edit_post_type', $can_edit, $post_type ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Use HTTPS for some sites of network | |
*/ | |
function rsssl_check_protocol_multisite($url, $scheme, $orig_scheme){ | |
if(get_current_blog_id() == 23){ | |
$url = str_replace("http://", "https://", $url); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private function wooms_nonce_check($nonce = ''){ | |
if(empty($nonce)){ | |
return false; | |
} | |
if($nonce == get_transient('wooms_nonce')){ | |
delete_transient('wooms_nonce'); | |
return true; | |
} else { | |
return false; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Generate login for new WP user | |
* | |
* return string uniq login | |
*/ | |
function generate_new_userlogin(){ | |
$users_ids = get_users('fields=ID&number=3&orderby=registered&order=DESC'); | |
$last_id = max($users_ids); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function wpcraft_zip_gzip_mime_types ( $mimes ) { | |
$existing_mimes['zip'] = 'application/zip'; | |
$existing_mimes['gz'] = 'application/x-gzip'; | |
return $mimes; | |
} | |
add_filter('upload_mimes', 'wpcraft_zip_gzip_mime_types'); | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Add Endpoint for URL Callback OAuth2 | |
*/ | |
class HAWP_Endpoint_Callback { | |
function __construct() { | |
add_action( 'init', array($this, 'add_endpoint') ); | |
add_action( 'wp_loaded', array($this, 'flush_rewrite_rules_hack') ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function wpc37174_special_nav_class($classes, $item){ | |
if( is_single() && $item->title == "Blog"){ | |
$classes[] = "special-class"; | |
} | |
return $classes; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'.text.html': | |
'Plugin': | |
'prefix': 'plugin-wp' | |
'body': '<?php\n/*\nPlugin Name: $1\nVersion: ${2:0.1}\nPlugin URI: ${TM_PLUGIN_BASE}$3\nDescription: $4\nAuthor: ${TM_NAME}\nAuthor URI: ${TM_HOMEPAGE}\n*/\n\n$5\n\n\n?>\n' | |
'Readme.txt': | |
'prefix': 'readme-wp-plugin' | |
'body': '=== ${1:Plugin Name} ===\nContributors: ${TM_WP_LOGIN}\nDonate link: ${TM_HOMEPAGE}\nTags: ${2:tag, tag}\nRequires at least: ${3:2.5}\nTested up to: ${4:2.8}\nStable tag: ${5:0.1}\n\n${6:Short description}\n\n== Description ==\n\n${7:Short description}\n\n== Installation ==\n\n1. Upload the \\`${8:plugin}\\` folder to the \\`/wp-content/plugins/\\` directory\n1. Activate the plugin through the \'Plugins\' menu in WordPress\n1. $9\n\n== Changelog ==\n\n= $5 =\n* Initial release.' |