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 / detect_playground.php
Created November 23, 2023 10:23 — forked from alanef/detect_playground.php
Detect WP Playground
<?php
if ( 'PHP.wasm' === $_SERVER['SERVER_SOFTWARE'] && 'playground.wordpress.net' === $_SERVER['HTTP_HOST'] ) {
// inside playground.wordpress.net
}
<?php
namespace Blocksy;
/*
*/
class Capabilities {
private $accounts_cache = null;
@vovafeldman
vovafeldman / multi-plan-buy-button.html
Last active June 8, 2023 15:43
Freemius Buy Button Code for a Multi-Plans Table
<script src="https://checkout.freemius.com/checkout.min.js"></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 / functions.php
Last active April 20, 2023 14:54
Freemius - weDocs KB Breadcrumbs Rich-Snipets
<?php
/**
* Override weDocs breadcrumb to add schema.org rich snippets metadata.
*
* @author Vova Feldman (@svovaf)
*
* @return void
*/
function freemius_wedocs_breadcrumbs() {
global $post;
@vovafeldman
vovafeldman / freemius-api-license-validation.php
Last active April 20, 2023 13:09
Validates a license key using Freemius API using the PHP SDK
<?php
// Freemius PHP SDK - https://github.com/Freemius/freemius-php-sdk
require_once './php-sdk-master/freemius/Freemius.php';
define( 'FS__API_SCOPE', 'developer' );
define( 'FS__API_DEV_ID', 1234 );
define( 'FS__API_PUBLIC_KEY', 'pk_YOUR_PUBLIC_KEY' );
define( 'FS__API_SECRET_KEY', 'sk_YOUR_SECRET_KEY' );
// Init SDK.
@vovafeldman
vovafeldman / freemius-checkout-ga-fb-tracking.js
Last active April 6, 2023 21:58
Tracking purchases with Google Analytics and Facebook for Freemius Checkout
//
// Gist was kindly contributed by @jamesckemp from @iconicwp. Thanks!
//
handler.open({
...
purchaseCompleted: function( response ) {
var trial = response.purchase.trial_ends !== null,
total = trial ? 0 : response.purchase.initial_amount.toString(),
productName = 'Product Name',
@vovafeldman
vovafeldman / my.cnf
Created February 21, 2022 17:30 — forked from chrisjlee/my.cnf
my.cnf file optimized for InnoDB 64bit setups
# forked from http://forge.mysql.com/tools/tool.php?id=137
[client]
#password = [your_password]
port = 3306
socket = /tmp/mysqld.sock
# *** Application-specific options follow here ***
#
@vovafeldman
vovafeldman / functions.php
Last active January 25, 2022 04:23
Freemius - WP Markdown Editor, Exporting
<?php
/**
* When exporting using WP default export tool, use the
* markdown version when exist.
*
* @author Vova Feldman
*
* @param string $content
*
* @return string
@vovafeldman
vovafeldman / functions.php
Last active October 27, 2021 14:05
Freemius - weDocs Permalinks
<?php
/**
* Customize docs permalinks parsing.
*
* @author Vova Feldman
*/
function freemius_docs_permastruct_rewrite() {
if ( post_type_exists( 'docs' ) ) {
// Modify root slug to "help" instead of docs.
@vovafeldman
vovafeldman / _sections-header.scss
Last active October 27, 2021 14:01
Freemius - weDocs Pretty Sections
// Header search
.page-header
{
.wedocs-search-form
{
position: relative;
input
{
@include placeholder(#999);