| 1 |
<?php |
| 2 |
namespace MBSocial; |
| 3 |
|
| 4 |
/** Remote Custom Network Class */ |
| 5 |
class customNetwork extends mbNetwork |
| 6 |
{ |
| 7 |
|
| 8 |
protected $priority = 'readmore'; |
| 9 |
protected $is_native = false; |
| 10 |
|
| 11 |
/** Function to set default for custom networks to the data that was imported from remote. |
| 12 |
* |
| 13 |
* Start state of custom network is all these defaults, but no save on the main settings branch |
| 14 |
*/ |
| 15 |
public function get_all_defaults() |
| 16 |
{ |
| 17 |
$network = MBSocial()->networks()->getNetworkSettings(); |
| 18 |
|
| 19 |
if (isset($network['custom'][$this->network])) |
| 20 |
{ |
| 21 |
|
| 22 |
$settings = $network['custom'][$this->network]; |
| 23 |
|
| 24 |
$all_options = $this->get_all_options(); |
| 25 |
|
| 26 |
foreach($all_options as $option => $value) |
| 27 |
{ |
| 28 |
if (isset($settings[$option])) |
| 29 |
{ |
| 30 |
$all_options[$option] = $settings[$option]; |
| 31 |
} |
| 32 |
} |
| 33 |
} |
| 34 |
return $all_options; |
| 35 |
} |
| 36 |
|
| 37 |
public function load_settings($settings) |
| 38 |
{ |
| 39 |
|
| 40 |
if (isset($settings['name'])) |
| 41 |
{ |
| 42 |
$this->network = $settings['name']; |
| 43 |
unset($settings['name']); |
| 44 |
} |
| 45 |
|
| 46 |
|
| 47 |
parent::load_settings($settings); |
| 48 |
|
| 49 |
} |
| 50 |
} |
| 51 |
|