| 1 |
<?php |
| 2 |
namespace MBSocial; |
| 3 |
|
| 4 |
class customNetwork extends mbNetwork |
| 5 |
{ |
| 6 |
|
| 7 |
protected $priority = 'readmore'; |
| 8 |
protected $is_native = false; |
| 9 |
|
| 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 |
//var_dump($network); var_dump($this->network); |
| 19 |
if (isset($network['custom'][$this->network])) |
| 20 |
{ |
| 21 |
|
| 22 |
$settings = $network['custom'][$this->network]; |
| 23 |
|
| 24 |
$all_options = $this->get_all_options(); |
| 25 |
// echo "<PRE>"; print_R($settings); print_r($all_options); |
| 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 |
parent::load_settings($settings); |
| 40 |
|
| 41 |
if (isset($settings['name'])) |
| 42 |
{ |
| 43 |
$this->network = $settings['name']; |
| 44 |
} |
| 45 |
|
| 46 |
/* foreach($fields as $name => $value) |
| 47 |
{ |
| 48 |
if ($name == 'name') |
| 49 |
$name = 'network'; |
| 50 |
if ($name == 'popup') |
| 51 |
$name = 'is_popup'; |
| 52 |
|
| 53 |
echo " $name - $value <BR>"; |
| 54 |
|
| 55 |
if ($value && strlen($value) > 0) |
| 56 |
$this->{$name} = $value; |
| 57 |
} |
| 58 |
*/ |
| 59 |
} |
| 60 |
} |
| 61 |
|