Exemplo n.º 1
0
 public static function lesscall()
 {
     CANVAS::import('core/less');
     $input = JFactory::getApplication()->input;
     $result = array();
     try {
         CANVASLess::compileAll($input->get('theme', ''));
         $result['successful'] = JText::_('CANVAS_MSG_COMPILE_SUCCESS');
     } catch (Exception $e) {
         $result['error'] = JText::sprintf('CANVAS_MSG_COMPILE_FAILURE', $e->__toString());
     }
     echo json_encode($result);
 }
Exemplo n.º 2
0
 /**
  *
  * Clone Profile
  */
 public static function duplicate($path)
 {
     $theme = JFactory::getApplication()->input->getCmd('theme');
     $from = JFactory::getApplication()->input->getCmd('from');
     $result = array();
     if (empty($theme) || empty($from)) {
         return self::error(JText::_('CANVAS_TM_INVALID_DATA_TO_SAVE'));
     }
     $source = $path . '/less/themes/' . $from;
     if (!JFolder::exists($source)) {
         return self::error(JText::sprintf('CANVAS_TM_NOT_FOUND', $from));
     }
     $dest = $path . '/less/themes/' . $theme;
     if (JFolder::exists($dest)) {
         return self::error(JText::sprintf('CANVAS_TM_EXISTED', $theme));
     }
     $result = array();
     if (@JFolder::copy($source, $dest) == true) {
         $result['success'] = JText::_('CANVAS_TM_CLONE_SUCCESSFULLY');
         $result['theme'] = $theme;
         $result['reset'] = true;
         $result['type'] = 'duplicate';
     } else {
         return self::error(JText::_('CANVAS_TM_OPERATION_FAILED'));
     }
     //LessHelper::compileForTemplate(CANVAS_TEMPLATE_PATH , $theme);
     CANVAS::import('core/less');
     CANVASLess::compileAll($theme);
     return self::response($result);
 }