/** * Rolls up all the template files for a product * * @param string - the product id * * @return bool - true if successful */ public function rollup_product_templates($product) { // get the path name for the products's xml file if (!($templates = $this->get_template_lists($product))) { $this->errors[] = "Could not find any templates for product: {$product}"; return false; } // prepare product xml using template array if ($product == 'vbulletin') { $xml = $this->get_vbulletin_template_xml($templates); } else { $xml = $this->get_product_template_xml($templates); } if (empty($xml)) { $this->errors[] = "Could not prepare the XML for product: {$product}"; return false; } // use a helper class to replace the changes to the style as // we write the master xml file to the filesystem require_once DIR . '/includes/class_filesystemxml_replace.php'; // if ($product == 'vbulletin') // { // $r = new vB_FilesystemXml_Replace_Style_Template($this->get_xmlpath($product), $xml); // } // else // { $r = new vB_FilesystemXml_Replace_Product_Template($this->get_xmlpath($product), $xml); // } $success = $r->replace(); unset($r); // if success is not set replace was successful, hence the strict equality check return $success !== false; }
/** * Rolls up all the template files for a product * * @param string - the product id * * @return bool - true if successful */ public function remove_product_templates($product) { // use a helper class to replace the changes to the style as // we write the master xml file to the filesystem require_once DIR . '/includes/class_filesystemxml_replace.php'; // prepare product xml using template array if ($product == 'vbulletin') { $xml = "\n<templategroup name=\"dummy\"></templategroup>"; } else { $xml = "\n<templates></templates>"; } if ($product == 'vbulletin') { $r = new vB_FilesystemXml_Replace_Style_Template($this->get_xmlpath($product), $xml); } else { $r = new vB_FilesystemXml_Replace_Product_Template($this->get_xmlpath($product), $xml); } return $r->replace(); }