Skip to content

Instantly share code, notes, and snippets.

View vovafeldman's full-sized avatar
🔥
Making sh*t happen

Vova Feldman vovafeldman

🔥
Making sh*t happen
View GitHub Profile
@vovafeldman
vovafeldman / functions.php
Last active October 19, 2016 23:12
Freemius - Changing Search Permastruct
<?php
/**
* Customize docs search permastruct for search caching.
*
* @author Vova Feldman
*/
function freemius_docs_search_permastruct_rewrite() {
if ( post_type_exists( 'docs' ) ) {
/**
* We want the search pages to be cached.
@vovafeldman
vovafeldman / functions.php
Last active October 31, 2016 22:44
Freemius - WordPress Head Cleanup
<?php
// Disable emoji.
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'wp_print_styles', 'print_emoji_styles' );
// Cleanup RPC.
remove_action( 'wp_head', 'rsd_link' );
remove_action( 'wp_head', 'wlwmanifest_link' );
// Cleanup oembed.
@vovafeldman
vovafeldman / dump-edd-key.php
Created November 17, 2016 16:45
Dump EDD license key.
<?php
function fs_dump_edd_key() {
if (is_admin()) {
$license_key = trim( get_option( 'my_edd_license_key' ) );
?>
<div class="notice notice-error is-dismissible">
<p>license key <?php echo $license_key ?></p>
</div>
<?php
}
@vovafeldman
vovafeldman / freemius-api-client.rb
Created December 19, 2016 23:25 — forked from cyberhobo/freemius-api-client.rb
Basis for a Ruby Freemius HTTP API client.
module Freemius
API_HOST = 'api.freemius.com'
SANDBOX_HOST = 'sandbox-api.freemius.com'
class Base
# Options taken from http://docs.freemius.apiary.io/#introduction/the-authentication-header
# * host Default is api.freemius.com
# * api_version Default is v1
# * scope_entity Default is 'plugin'. Could also be 'developer', 'install', 'site', 'user'
# * scope_entity_id Required.

Contributor License Agreement

The following terms are used throughout this agreement:

You - the person or legal entity including its affiliates asked to accept this agreement. An affiliate is any entity that controls or is controlled by the legal entity, or is under common control with it.

Project - is an umbrella term that refers to any and all Freemius, Inc. open source projects.

Contribution - any type of work that is submitted to a Project, including any modifications or additions to existing work.

Submitted - conveyed to a Project via a pull request, commit, issue, or any form of electronic, written, or verbal communication with Freemius, Inc., contributors or maintainers.

@vovafeldman
vovafeldman / hide-account-submenu.php
Last active August 21, 2019 16:59
Hide FS account submenu item
<?php
function fs_hide_account( $is_visible, $submenu_id ) {
if ( 'account' === $submenu_id ) {
return false;
}
return $is_visible;
}
add_filter( 'fs_is_submenu_visible_{slug}', 'fs_hide_account', 10, 2 );
<?php
function _uninstall_plugin_event( $check_user = true ) {
$this->_logger->entrance( 'slug = ' . $this->_slug );
if ( $check_user && ! current_user_can( 'activate_plugins' ) ) {
return;
}
$params = array();
$uninstall_reason = null;
@vovafeldman
vovafeldman / software-licensing.php
Created July 5, 2017 00:54
Freemius Software Licensing Examples
<?php
// This IF block will be auto removed from the Free version.
if ( my_fs()->is__premium_only() ) {
// This IF will be executed only if the user in a trial mode or have a valid license.
if ( my_fs()->can_use_premium_code() ) {
// ... logic related to any paid plan ...
}
if ( my_fs()->is_plan('starter') ) {
// ... logic related to starter plan and higher plans ...
@vovafeldman
vovafeldman / multi-plan-buy-button.html
Last active November 4, 2024 09:14
Freemius Buy Button Code for a Multi-Plans Table
<script src="https://checkout.freemius.com/js/v1/"></script>
<select id="starter-licenses">
<option value="1" selected="selected">Single Site License</option>
<option value="5">5-Site License</option>
<option value="25">25-Site License</option>
<option value="unlimited">Unlimited Sites License</option>
</select>
<button id="starter-purchase">Buy Starter</button>
@vovafeldman
vovafeldman / wordpress-tabs.php
Created February 28, 2018 15:56
Adding tabs
<div class="wrap">
<h2 class="nav-tab-wrapper">
<a href="#" class="nav-tab nav-tab-active"><?php __( 'Getting Started', 'text-domain' ) ?></a>
</h2>
</div>