formguide.class.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. defined('IN_PHPCMS') or exit('No permission resources.');
  3. //模型原型存储路径
  4. define('MODEL_PATH',PC_PATH.'modules'.DIRECTORY_SEPARATOR.'formguide'.DIRECTORY_SEPARATOR.'fields'.DIRECTORY_SEPARATOR);
  5. //模型缓存路径
  6. define('CACHE_MODEL_PATH',PHPCMS_PATH.'caches'.DIRECTORY_SEPARATOR.'caches_model'.DIRECTORY_SEPARATOR.'caches_data'.DIRECTORY_SEPARATOR);
  7. /**
  8. * 更新form表单模型类
  9. * @author
  10. *
  11. */
  12. class formguide {
  13. public function __construct() {
  14. }
  15. /**
  16. * 更新模型缓存方法
  17. */
  18. public function public_cache() {
  19. require MODEL_PATH.'fields.inc.php';
  20. //更新内容模型类:表单生成、入库、更新、输出
  21. $classtypes = array('form','input','update','output');
  22. foreach($classtypes as $classtype) {
  23. $cache_data = file_get_contents(MODEL_PATH.'formguide_'.$classtype.'.class.php');
  24. $cache_data = str_replace('}?>','',$cache_data);
  25. foreach($fields as $field=>$fieldvalue) {
  26. if(file_exists(MODEL_PATH.$field.DIRECTORY_SEPARATOR.$classtype.'.inc.php')) {
  27. $cache_data .= file_get_contents(MODEL_PATH.$field.DIRECTORY_SEPARATOR.$classtype.'.inc.php');
  28. }
  29. }
  30. $cache_data .= "\r\n } \r\n?>";
  31. file_put_contents(CACHE_MODEL_PATH.'formguide_'.$classtype.'.class.php',$cache_data);
  32. @chmod(CACHE_MODEL_PATH.'formguide_'.$classtype.'.class.php',0777);
  33. }
  34. return true;
  35. }
  36. }
  37. ?>