PluginProbe
Parallax Section Block – give any section scroll-stopping depth / 2.0.3
Parallax Section Block – give any section scroll-stopping depth v2.0.3
2.0.4 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.7 1.0.8 1.0.9 2.0.0 2.0.1 2.0.2 2.0.3
parallax-section / plugin.php

plugin.php in Parallax Section Block – give any section scroll-stopping depth 2.0.3, at plugin.php

127 lines 4.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Plugin Name: Parallax Section - Block
5 * Description: Makes background element scrolls slower than foreground content.
6 * Version: 2.0.3
7 * Author: bPlugins
8 * Author URI: https://bplugins.com
9 * License: GPLv3
10 * License URI: https://www.gnu.org/licenses/gpl-3.0.txt
11 * Text Domain: parallax-section
12 */
13 // ABS PATH
14 if ( !defined( 'ABSPATH' ) ) {
15 exit;
16 }
17 if ( function_exists( 'ps_fs' ) ) {
18 register_activation_hook( __FILE__, function () {
19 // 'swiper-slider/swiper-slider.php' ---> ai line er prothom ta slug r porer ta php file er name
20 if ( is_plugin_active( 'parallax-section/plugin.php' ) ) {
21 deactivate_plugins( 'parallax-section/plugin.php' );
22 }
23 if ( is_plugin_active( 'parallax-section-pro/plugin.php' ) ) {
24 deactivate_plugins( 'parallax-section-pro/plugin.php' );
25 }
26 } );
27 } else {
28 define( 'PSB_VERSION', ( isset( $_SERVER['HTTP_HOST'] ) && 'localhost' === $_SERVER['HTTP_HOST'] ? time() : '2.0.3' ) );
29 define( 'PSB_DIR_URL', plugin_dir_url( __FILE__ ) );
30 define( 'PSB_DIR_PATH', plugin_dir_path( __FILE__ ) );
31 define( 'PARALLAX_HAS_PRO', file_exists( dirname( __FILE__ ) . '/freemius/start.php' ) );
32 if ( !function_exists( 'ps_fs' ) ) {
33 function ps_fs() {
34 global $ps_fs;
35 if ( !isset( $ps_fs ) ) {
36 if ( PARALLAX_HAS_PRO ) {
37 require_once dirname( __FILE__ ) . '/freemius/start.php';
38 } else {
39 require_once dirname( __FILE__ ) . '/freemius-lite/start.php';
40 }
41 $apbConfig = array(
42 'id' => '19833',
43 'slug' => 'parallax-section',
44 'type' => 'plugin',
45 'public_key' => 'pk_b230abfa498765ac9fd6a75cdfde2',
46 'is_premium' => false,
47 'premium_suffix' => 'Pro',
48 'has_premium_version' => true,
49 'has_addons' => false,
50 'has_paid_plans' => true,
51 'trial' => array(
52 'days' => 7,
53 'is_require_payment' => false,
54 ),
55 'menu' => array(
56 'slug' => 'parallax-section-dashboard',
57 'first-path' => 'tools.php?page=parallax-section-dashboard#/welcome',
58 'support' => false,
59 'parent' => array(
60 'slug' => 'tools.php',
61 ),
62 ),
63 );
64 $ps_fs = ( PARALLAX_HAS_PRO ? fs_dynamic_init( $apbConfig ) : fs_lite_dynamic_init( $apbConfig ) );
65 }
66 return $ps_fs;
67 }
68
69 ps_fs();
70 do_action( 'ps_fs_loaded' );
71 }
72 function psIsPremium() {
73 return ( PARALLAX_HAS_PRO ? ps_fs()->can_use_premium_code() : false );
74 }
75
76 // ... Your plugin's main file logic ...
77 require_once PSB_DIR_PATH . 'includes/GetCSS.php';
78 if ( PARALLAX_HAS_PRO ) {
79 require_once PSB_DIR_PATH . 'includes/LicenseActivation.php';
80 }
81 if ( !class_exists( 'PSBPlugin' ) ) {
82 class PSBPlugin {
83 function __construct() {
84 add_action( 'init', [$this, 'onInit'] );
85 add_action( 'enqueue_block_editor_assets', [$this, "enqueueBlockEditorAssets"] );
86 add_filter(
87 'default_title',
88 [$this, 'defaultTitle'],
89 10,
90 2
91 );
92 add_filter(
93 'default_content',
94 [$this, 'defaultContent'],
95 10,
96 2
97 );
98 }
99
100 function defaultTitle( $title, $post ) {
101 if ( 'page' === $post->post_type && isset( $_GET['title'] ) ) {
102 return sanitize_text_field( wp_unslash( $_GET['title'] ) );
103 }
104 return $title;
105 }
106
107 function defaultContent( $content, $post ) {
108 if ( 'page' === $post->post_type && isset( $_GET['content'] ) ) {
109 return wp_unslash( $_GET['content'] );
110 }
111 return $content;
112 }
113
114 function enqueueBlockEditorAssets() {
115 wp_add_inline_script( 'psb-parallax-editor-script', 'const psbpipecheck = ' . wp_json_encode( psIsPremium() ) . ';', 'before' );
116 }
117
118 function onInit() {
119 register_block_type( __DIR__ . '/build' );
120 }
121
122 }
123
124 new PSBPlugin();
125 }
126 }
127 require_once PSB_DIR_PATH . '/includes/Menu.php';