| 1 |
<?php |
| 2 |
/** |
| 3 |
* @package SheetsPilot |
| 4 |
* @author Unlimited Elements |
| 5 |
* @copyright (C) 2026 Unlimited Elements, All Rights Reserved. |
| 6 |
* @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html |
| 7 |
**/ |
| 8 |
if ( ! defined( 'ABSPATH' ) ) exit; |
| 9 |
if(!defined("SHEETSPILOT_INC")) die("restricted access"); |
| 10 |
|
| 11 |
class SheetsPilot_Object{ |
| 12 |
|
| 13 |
private $type; |
| 14 |
private $id; |
| 15 |
private $object; |
| 16 |
|
| 17 |
|
| 18 |
/** |
| 19 |
* init object by id and type |
| 20 |
*/ |
| 21 |
public function init($type, $id){ |
| 22 |
|
| 23 |
$objIntegrations = new SheetsPilot_Integrations(); |
| 24 |
|
| 25 |
$this->id = $id; |
| 26 |
$this->type = $type; |
| 27 |
|
| 28 |
switch($type){ |
| 29 |
case SheetsPilotGlobals::EXPORT_TYPE_SNIPPET: |
| 30 |
|
| 31 |
$this->object = $objIntegrations->getSnippetById($id); |
| 32 |
|
| 33 |
break; |
| 34 |
default: |
| 35 |
|
| 36 |
$type = esc_html($type); |
| 37 |
$id = (int)$id; |
| 38 |
|
| 39 |
SheetsPilotFunctions::throwError("Object $type with id: $id not found"); |
| 40 |
|
| 41 |
break; |
| 42 |
} |
| 43 |
|
| 44 |
|
| 45 |
} |
| 46 |
|
| 47 |
} |