| @@ -1,7 +1,8 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | namespace MBSocial; |
| 3 | 3 | |
| 4 | +/** Remote Custom Network Class */ | |
| 4 | 5 | class customNetwork extends mbNetwork |
| 5 | 6 | { |
| 6 | 7 | |
| 7 | 8 | protected $priority = 'readmore'; |
| @@ -6,14 +7,34 @@ | ||
| 6 | 7 | |
| 7 | 8 | protected $priority = 'readmore'; |
| 8 | 9 | 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(); | |
| 10 | 18 | |
| 11 | -/* public function set() | |
| 12 | - { | |
| 19 | + if (isset($network['custom'][$this->network])) | |
| 20 | + { | |
| 13 | 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; | |
| 14 | 35 | } |
| 15 | -*/ | |
| 36 | + | |
| 16 | 37 | public function load_settings($settings) |
| 17 | 38 | { |
| 18 | 39 | parent::load_settings($settings); |
| 19 | 40 | |
| @@ -20,20 +41,6 @@ | ||
| 20 | 41 | if (isset($settings['name'])) |
| 21 | 42 | { |
| 22 | 43 | $this->network = $settings['name']; |
| 23 | 44 | } |
| 24 | - | |
| 25 | - /* foreach($fields as $name => $value) | |
| 26 | - { | |
| 27 | - if ($name == 'name') | |
| 28 | - $name = 'network'; | |
| 29 | - if ($name == 'popup') | |
| 30 | - $name = 'is_popup'; | |
| 31 | - | |
| 32 | - echo " $name - $value <BR>"; | |
| 33 | - | |
| 34 | - if ($value && strlen($value) > 0) | |
| 35 | - $this->{$name} = $value; | |
| 36 | - } | |
| 37 | -*/ | |
| 38 | 45 | } |
| 39 | 46 | } |