Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
content_type_raw_html_management.inc
1 <?php
18 require_once SQ_INCLUDE_PATH.'/asset_management.inc';
19 
31 {
32 
33 
38  function __construct(&$pm)
39  {
40  $this->Asset_Management($pm);
41 
42  }//end constructor
43 
44 
53  function _upgrade($current_version)
54  {
55  if (version_compare($current_version,'0.2','<')) {
56  $user_group_ids = $GLOBALS['SQ_SYSTEM']->am->getTypeAssetids('user_group');
57  $user_group_assets = Array();
58  for ($i=0; $i < count($user_group_ids); $i++) {
59  if (file_exists(SQ_DATA_PATH.'/private/assets/user_group/'.$user_group_ids[$i].'/.preferences.inc')) {
60  $this->_updatePreferences(SQ_DATA_PATH.'/private/assets/user_group/'.$user_group_ids[$i].'/.preferences.inc');
61  }
62  }
63  if (file_exists(SQ_DATA_PATH.'/private/conf/preferences.inc')) {
64  $this->_updatePreferences(SQ_DATA_PATH.'/private/conf/preferences.inc');
65  }
66  }
67  return parent::_upgrade($current_version);
68 
69  }//end _upgrade()
70 
71 
80  function _updatePreferences($file_name)
81  {
82  include $file_name;
83  if (!empty($preferences['content_type_raw_html']['SQ_RAW_HTML_SIZE']['default'])) {
84  $width = (int) $preferences['content_type_raw_html']['SQ_RAW_HTML_SIZE']['default']['width'];
85  $preferences['content_type_raw_html']['SQ_RAW_HTML_SIZE']['default']['width'] = ($width * 1.5).'ex';
86 
87  $height = (int) $preferences['content_type_raw_html']['SQ_RAW_HTML_SIZE']['default']['height'];
88  $preferences['content_type_raw_html']['SQ_RAW_HTML_SIZE']['default']['height'] = ($height * 2).'ex';
89 
90  $fp = fopen($file_name, 'w');
91 
92  if ($fp) {
93  fwrite($fp, '<?php $preferences = ');
94  ob_start();
95  var_export($preferences);
96  $preferences = ob_get_contents();
97  ob_end_clean();
98  fwrite($fp, $preferences);
99  fwrite($fp, ';?>');
100  fclose($fp);
101  }
102  }
103 
104  }//end _updatePreferences()
105 
106 
107 }//end class
108 
109 ?>