| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Plugin Name: Team Section - Block |
| 5 |
* Description: Makes background element scrolls slower than foreground content. |
| 6 |
* Version: 2.0.0 |
| 7 |
* Author: bPlugins |
| 8 |
* Author URI: http://bplugins.com |
| 9 |
* License: GPLv3 |
| 10 |
* License URI: https://www.gnu.org/licenses/gpl-3.0.txt |
| 11 |
* Text Domain: team-section |
| 12 |
*/ |
| 13 |
// ABS PATH |
| 14 |
if ( !defined( 'ABSPATH' ) ) { |
| 15 |
exit; |
| 16 |
} |
| 17 |
if ( function_exists( 'ts_fs' ) ) { |
| 18 |
ts_fs()->set_basename( false, __FILE__ ); |
| 19 |
} else { |
| 20 |
// Constant |
| 21 |
define( 'TSB_VERSION', ( isset( $_SERVER['HTTP_HOST'] ) && 'localhost' === $_SERVER['HTTP_HOST'] ? time() : '1.1.0' ) ); |
| 22 |
define( 'TSB_DIR_URL', plugin_dir_url( __FILE__ ) ); |
| 23 |
define( 'TSB_DIR_PATH', plugin_dir_path( __FILE__ ) ); |
| 24 |
define( 'TEAM_SECTION_BLOCK_PRO', file_exists( dirname( __FILE__ ) . '/freemius/start.php' ) ); |
| 25 |
if ( !function_exists( 'ts_fs' ) ) { |
| 26 |
function ts_fs() { |
| 27 |
global $ts_fs; |
| 28 |
// Include Freemius SDK. |
| 29 |
if ( !isset( $ts_fs ) ) { |
| 30 |
if ( TEAM_SECTION_BLOCK_PRO ) { |
| 31 |
require_once dirname( __FILE__ ) . '/freemius/start.php'; |
| 32 |
} else { |
| 33 |
require_once dirname( __FILE__ ) . '/freemius-lite/start.php'; |
| 34 |
} |
| 35 |
$apbConfig = array( |
| 36 |
'id' => '21587', |
| 37 |
'slug' => 'team-section', |
| 38 |
'premium_slug' => 'team-section-pro', |
| 39 |
'type' => 'plugin', |
| 40 |
'public_key' => 'pk_3ba5bf1bfe18f86fccd5a5995ae77', |
| 41 |
'is_premium' => true, |
| 42 |
'premium_suffix' => 'Pro', |
| 43 |
'has_premium_version' => true, |
| 44 |
'has_addons' => false, |
| 45 |
'has_paid_plans' => true, |
| 46 |
'menu' => array( |
| 47 |
'slug' => 'edit.php?post_type=tsb', |
| 48 |
'first-path' => 'edit.php?post_type=tsb&page=team-section-dashboard', |
| 49 |
'support' => false, |
| 50 |
), |
| 51 |
); |
| 52 |
$ts_fs = ( TEAM_SECTION_BLOCK_PRO ? fs_dynamic_init( $apbConfig ) : fs_lite_dynamic_init( $apbConfig ) ); |
| 53 |
} |
| 54 |
return $ts_fs; |
| 55 |
} |
| 56 |
|
| 57 |
ts_fs(); |
| 58 |
// Signal that SDK was initiated. |
| 59 |
do_action( 'ts_fs_loaded' ); |
| 60 |
} |
| 61 |
function tsbIsPremium() { |
| 62 |
return ( TEAM_SECTION_BLOCK_PRO ? ts_fs()->can_use_premium_code() : false ); |
| 63 |
} |
| 64 |
|
| 65 |
require_once TSB_DIR_PATH . '/includes/ShortCode.php'; |
| 66 |
require_once TSB_DIR_PATH . '/includes/AdminMenu.php'; |
| 67 |
if ( !class_exists( 'TSBPlugin' ) ) { |
| 68 |
class TSBPlugin { |
| 69 |
function __construct() { |
| 70 |
add_action( 'enqueue_block_assets', [$this, 'enqueueBockAssets'] ); |
| 71 |
add_action( 'init', [$this, 'onInit'] ); |
| 72 |
add_action( 'enqueue_block_editor_assets', [$this, 'tsmEnqueueBlockEditorAssets'] ); |
| 73 |
add_action( 'wp_enqueue_scripts', [$this, 'tsmEnqueueBlockEditorAssets'] ); |
| 74 |
} |
| 75 |
|
| 76 |
function enqueueBockAssets() { |
| 77 |
wp_register_style( |
| 78 |
'fontAwesome', |
| 79 |
TSB_DIR_URL . 'assets/css/font-awesome.min.css', |
| 80 |
[], |
| 81 |
'6.4.2' |
| 82 |
); |
| 83 |
} |
| 84 |
|
| 85 |
function tsmEnqueueBlockEditorAssets() { |
| 86 |
wp_add_inline_script( 'tsb-team-editor-script', 'const tsmbpipecheck = ' . wp_json_encode( tsbIsPremium() ) . ';', 'before' ); |
| 87 |
wp_add_inline_script( 'tsb-team-view-script', 'const tsmbpipecheck = ' . wp_json_encode( tsbIsPremium() ) . ';', 'before' ); |
| 88 |
} |
| 89 |
|
| 90 |
function onInit() { |
| 91 |
register_block_type( __DIR__ . '/build' ); |
| 92 |
} |
| 93 |
|
| 94 |
} |
| 95 |
|
| 96 |
new TSBPlugin(); |
| 97 |
} |
| 98 |
} |
| 99 |
// require_once TSB_DIR_PATH . 'inc/block.php'; |