Example #1
0
 /**
  * Global config has been saved.
  * Check the product key and if it exists create an update site entry
  * Update server XML manifest generated from update/premium.php
  *
  * @param string          $option
  * @param JTableExtension $data
  */
 function onExtensionAfterSave($option, $data)
 {
     if ($option !== 'com_config.component') {
         return;
     }
     if ($data->get('name') !== 'com_fabrik') {
         return;
     }
     $props = $data->getProperties();
     $params = new JRegistry($props['params']);
     $productKey = $params->get('fabrik_product_key', '');
     if ($productKey === '') {
         return;
     }
     $table = JTable::getInstance('Updatesite');
     $table->load(array('name' => 'Fabrik - Premium'));
     $table->save(array('type' => 'collection', 'name' => 'Fabrik - Premium', 'enabled' => 1, 'location' => 'http://localhost:81/fabrik31x/public_html/update/premium.php?productKey=' . $productKey));
 }