| 1 |
<?php |
| 2 |
|
| 3 |
|
| 4 |
/* |
| 5 |
* Plugin Name: 3D Viewer – Display Interactive 3D Models |
| 6 |
* Plugin URI: https://bplugins.com/ |
| 7 |
* Description: Easily display interactive 3D models on the web. Supported File type .glb, .gltf,obj 3ds stl ply off 3dm fbx dae wrl 3mf amf ifc brep step iges fcstd bim |
| 8 |
* Version: 1.8.11 |
| 9 |
* Author: bPlugins |
| 10 |
* Author URI: http://bplugins.com |
| 11 |
* Requires PHP: 7.4 |
| 12 |
* Requires at least: 5.8 |
| 13 |
* Tested up to: 6.9 |
| 14 |
* License: GPLv2 or later |
| 15 |
* Text Domain: 3d-viewer |
| 16 |
* Domain Path: /languages |
| 17 |
*/ |
| 18 |
|
| 19 |
if (!defined('ABSPATH')) { |
| 20 |
exit; |
| 21 |
} |
| 22 |
|
| 23 |
if (function_exists('bp3d_fs')) { |
| 24 |
bp3d_fs()->set_basename(true, __FILE__); |
| 25 |
} else { |
| 26 |
|
| 27 |
if (file_exists(dirname(__FILE__) . '/vendor/autoload.php')) { |
| 28 |
require_once(dirname(__FILE__) . '/vendor/autoload.php'); |
| 29 |
} |
| 30 |
if (file_exists(dirname(__FILE__) . '/inc/admin.php')) { |
| 31 |
require_once(dirname(__FILE__) . '/inc/admin.php'); |
| 32 |
} |
| 33 |
|
| 34 |
|
| 35 |
if (defined('WP_DEBUG') && WP_DEBUG === true) { |
| 36 |
define('BP3D_VERSION', time()); |
| 37 |
} else { |
| 38 |
define('BP3D_VERSION', '1.8.11'); |
| 39 |
} |
| 40 |
|
| 41 |
defined('BP3D_DIR') or define('BP3D_DIR', plugin_dir_url(__FILE__)); |
| 42 |
defined('BP3D_PATH') or define('BP3D_PATH', plugin_dir_path(__FILE__)); |
| 43 |
defined('BP3D_TEMPLATE_PATH') or define('BP3D_TEMPLATE_PATH', plugin_dir_path(__FILE__) . 'inc/Template/'); |
| 44 |
defined('BP3D__FILE__') or define('BP3D__FILE__', __FILE__); |
| 45 |
define('BP3D_IMPORT_VER', '1.0.0'); |
| 46 |
|
| 47 |
if (!function_exists('bp3d_fs')) { |
| 48 |
// Create a helper function for easy SDK access. |
| 49 |
function bp3d_fs() |
| 50 |
{ |
| 51 |
global $bp3d_fs; |
| 52 |
|
| 53 |
if (!isset($bp3d_fs)) { |
| 54 |
// Include Freemius SDK. |
| 55 |
// SDK is auto-loaded through composer |
| 56 |
$bp3d_fs = fs_dynamic_init(array( |
| 57 |
'id' => '8795', |
| 58 |
'slug' => '3d-viewer', |
| 59 |
'premium_slug' => '3d-viewer-premium', |
| 60 |
'type' => 'plugin', |
| 61 |
'public_key' => 'pk_5e6ce3f226c86e3b975b59ed84d6a', |
| 62 |
'is_premium' => false, |
| 63 |
// If your plugin is a serviceware, set this option to false. |
| 64 |
'has_addons' => false, |
| 65 |
'has_affiliation' => 'selected', |
| 66 |
'menu' => array( |
| 67 |
'slug' => 'edit.php?post_type=bp3d-model-viewer', |
| 68 |
'first-path' => 'edit.php?post_type=bp3d-model-viewer&page=3d-viewer', |
| 69 |
'support' => false, |
| 70 |
'affiliation' => false, |
| 71 |
'contact' => false, |
| 72 |
), |
| 73 |
)); |
| 74 |
} |
| 75 |
|
| 76 |
return $bp3d_fs; |
| 77 |
} |
| 78 |
|
| 79 |
// Init Freemius. |
| 80 |
bp3d_fs(); |
| 81 |
// Signal that SDK was initiated. |
| 82 |
do_action('bp3d_fs_loaded'); |
| 83 |
} |
| 84 |
|
| 85 |
if (file_exists(dirname(__FILE__) . '/inc/Base/LicenseActivation.php')) { |
| 86 |
require_once(dirname(__FILE__) . '/inc/Base/LicenseActivation.php'); |
| 87 |
} |
| 88 |
|
| 89 |
|
| 90 |
// External files Inclusion |
| 91 |
require_once 'vendor/codestar-framework/codestar-framework.php'; |
| 92 |
|
| 93 |
if (!class_exists('BP3D')) { |
| 94 |
class BP3D |
| 95 |
{ |
| 96 |
protected static $instance = null; |
| 97 |
|
| 98 |
public static function get_instance() |
| 99 |
{ |
| 100 |
if (null === self::$instance) { |
| 101 |
self::$instance = new self(); |
| 102 |
} |
| 103 |
return self::$instance; |
| 104 |
} |
| 105 |
|
| 106 |
public function __construct() |
| 107 |
{ |
| 108 |
$init_file = BP3D_PATH . 'inc/Init.php'; |
| 109 |
if (file_exists($init_file)) { |
| 110 |
require_once($init_file); |
| 111 |
} |
| 112 |
if (class_exists('BP3D\\Init')) { |
| 113 |
\BP3D\Init::instance()->init(); |
| 114 |
} |
| 115 |
add_action('plugins_loaded', array($this, 'plugins_loaded')); |
| 116 |
add_action('init', [$this, 'load_plugin_textdomain']); |
| 117 |
} |
| 118 |
|
| 119 |
public function load_plugin_textdomain() |
| 120 |
{ |
| 121 |
// Try the NEW slug first (for future translations from WordPress.org) |
| 122 |
$loaded = load_plugin_textdomain('3d-viewer', false, dirname(plugin_basename(__FILE__)) . '/languages'); |
| 123 |
|
| 124 |
// If that fails, fall back to the OLD domain (for existing user translations) |
| 125 |
if (!$loaded) { |
| 126 |
load_plugin_textdomain('model-viewer', false, dirname(plugin_basename(__FILE__)) . '/languages'); |
| 127 |
} |
| 128 |
} |
| 129 |
|
| 130 |
function plugins_loaded() |
| 131 |
{ |
| 132 |
if (class_exists('BP3D\\Init')) { |
| 133 |
\BP3D\Init::register_post_type(); |
| 134 |
} |
| 135 |
} |
| 136 |
} |
| 137 |
BP3D::get_instance(); |
| 138 |
} |
| 139 |
|
| 140 |
} |
| 141 |
|
| 142 |
|
| 143 |
|
| 144 |
|