コード例 #1
0
ファイル: table.php プロジェクト: thangredweb/redCORE
 /**
  * Delete Content Element Table and XML file
  *
  * @param   string  $option   The Extension Name ex. com_redcore
  * @param   string  $xmlFile  XML file to install
  *
  * @return  boolean  Returns true if Content element was successfully purged
  */
 public static function deleteContentElement($option = 'com_redcore', $xmlFile = '')
 {
     // Load Content Element
     $contentElement = RTranslationHelper::getContentElement($option, $xmlFile);
     if (self::uninstallContentElement($option, $xmlFile) || empty($contentElement->table)) {
         if (empty($contentElement)) {
             JFactory::getApplication()->enqueueMessage(JText::_('COM_REDCORE_CONFIG_TRANSLATIONS_CONTENT_ELEMENT_NOT_INSTALLED'), 'warning');
             return false;
         }
         $xmlFilePath = RTranslationContentElement::getContentElementXmlPath($option, $xmlFile);
         try {
             JFile::delete($xmlFilePath);
         } catch (Exception $e) {
             JFactory::getApplication()->enqueueMessage(JText::sprintf('LIB_REDCORE_TRANSLATIONS_CONTENT_ELEMENT_ERROR', $e->getMessage()), 'error');
             return false;
         }
         JFactory::getApplication()->enqueueMessage(JText::_('COM_REDCORE_CONFIG_TRANSLATIONS_CONTENT_ELEMENT_DELETED'), 'message');
         return true;
     }
     return false;
 }