templates-patterns-collection
Last commit date
assets
2 weeks ago
beaver
1 year ago
e2e-tests
1 week ago
editor
1 year ago
elementor
1 year ago
includes
1 week ago
languages
1 week ago
migration
5 years ago
onboarding
1 week ago
shared
2 years ago
vendor
1 week ago
.browserslistrc
1 year ago
.eslintrc
1 year ago
AGENTS.md
1 week ago
CHANGELOG.md
1 week ago
CONTRIBUTING.md
2 years ago
README.md
1 week ago
phpstan.neon
2 weeks ago
readme.txt
1 week ago
templates-patterns-collection.php
1 week ago
yarn.lock
1 year ago
templates-patterns-collection.php
98 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Plugin Name: Starter Sites & Templates by Neve |
| 4 | * Description: This plugin gives you access to 100+ templates and ready-to-use starter sites. Neve theme is used for all the designs. |
| 5 | * Version: 1.4.0 |
| 6 | * Author: Themeisle |
| 7 | * Author URI: https://themeisle.com |
| 8 | * License: GPLv3 |
| 9 | * License URI: https://www.gnu.org/licenses/gpl-3.0.en.html |
| 10 | * Text Domain: templates-patterns-collection |
| 11 | * Domain Path: /languages |
| 12 | * WordPress Available: yes |
| 13 | * Requires License: no |
| 14 | * |
| 15 | * @package templates-patterns-collection |
| 16 | */ |
| 17 | |
| 18 | add_action( 'init', 'ti_tpc_load_textdomain' ); |
| 19 | add_action( 'init', 'ti_tpc_flush_premalinks' ); |
| 20 | |
| 21 | /** |
| 22 | * Flush the permalinks after import |
| 23 | * |
| 24 | */ |
| 25 | function ti_tpc_flush_premalinks() { |
| 26 | $flash_rules = get_transient( 'ti_tpc_should_flush_permalinks' ); |
| 27 | if ( $flash_rules !== 'yes' ) { |
| 28 | return false; |
| 29 | } |
| 30 | |
| 31 | flush_rewrite_rules(); |
| 32 | delete_transient( 'ti_tpc_should_flush_permalinks' ); |
| 33 | |
| 34 | return true; |
| 35 | } |
| 36 | |
| 37 | add_filter( 'themeisle_sdk_products', 'tpc_load_sdk' ); |
| 38 | |
| 39 | /** |
| 40 | * Filter products array. |
| 41 | * |
| 42 | * @param array $products products array. |
| 43 | * |
| 44 | * @return array |
| 45 | */ |
| 46 | function tpc_load_sdk( $products ) { |
| 47 | $products[] = __FILE__; |
| 48 | return $products; |
| 49 | } |
| 50 | /** |
| 51 | * Load the localisation file. |
| 52 | */ |
| 53 | function ti_tpc_load_textdomain() { |
| 54 | load_plugin_textdomain( 'templates-patterns-collection', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); |
| 55 | } |
| 56 | |
| 57 | define( 'TIOB_VERSION', '1.4.0' ); |
| 58 | define( 'TIOB_URL', plugin_dir_url( __FILE__ ) ); |
| 59 | define( 'TIOB_PATH', dirname( __FILE__ ) . '/' ); |
| 60 | define( 'TIOB_BASENAME', plugin_basename( __FILE__ ) ); |
| 61 | |
| 62 | $autoload_path = __DIR__ . '/vendor/autoload.php'; |
| 63 | if ( is_file( $autoload_path ) ) { |
| 64 | require_once $autoload_path; |
| 65 | } |
| 66 | add_action( 'init', 'ti_tpc_run', 999 ); |
| 67 | |
| 68 | function ti_tpc_run() { |
| 69 | if ( ! defined( 'TI_ONBOARDING_DISABLED' ) ) { |
| 70 | define( 'TI_ONBOARDING_DISABLED', false ); |
| 71 | } |
| 72 | |
| 73 | if ( class_exists( 'WP_CLI' ) ) { |
| 74 | require_once 'includes/WP_Cli.php'; |
| 75 | } |
| 76 | |
| 77 | define( |
| 78 | 'TIOB_FEATURES', |
| 79 | array( |
| 80 | 'new_menu' => true, |
| 81 | ) |
| 82 | ); |
| 83 | |
| 84 | \TIOB\Main::instance(); |
| 85 | } |
| 86 | |
| 87 | function ti_tpc_activation_redirect( $product ) { |
| 88 | // If the installation time is not set, it means TPC is installed for the first time. |
| 89 | if ( empty( get_option( 'templates_patterns_collection_install' ) ) ) { |
| 90 | update_option( 'tpc_obd_new_user', 'yes' ); |
| 91 | } |
| 92 | if ( ( current_action() === 'activated_plugin' && $product === TIOB_BASENAME ) || current_action() === 'switch_theme' ) { |
| 93 | add_option( 'tpc_maybe_run_onboarding', true ); |
| 94 | } |
| 95 | } |
| 96 | add_action( 'activated_plugin', 'ti_tpc_activation_redirect' ); |
| 97 | add_action( 'switch_theme', 'ti_tpc_activation_redirect' ); |
| 98 |