@@ -36,46 +36,46 @@ discard block |
||
| 36 | 36 | private $export_plugins; |
| 37 | 37 | |
| 38 | 38 | public function __construct() { |
| 39 | - Framework::includeJS('.','export_dialog','importexport'); |
|
| 40 | - Framework::includeJS('.','importexport','importexport'); |
|
| 39 | + Framework::includeJS('.', 'export_dialog', 'importexport'); |
|
| 40 | + Framework::includeJS('.', 'importexport', 'importexport'); |
|
| 41 | 41 | $this->user = $GLOBALS['egw_info']['user']['user_id']; |
| 42 | - $this->export_plugins = importexport_helper_functions::get_plugins('all','export'); |
|
| 42 | + $this->export_plugins = importexport_helper_functions::get_plugins('all', 'export'); |
|
| 43 | 43 | |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | - public function export_dialog($_content=array()) { |
|
| 46 | + public function export_dialog($_content = array()) { |
|
| 47 | 47 | $tabs = 'general_tab|selection_tab|options_tab'; |
| 48 | 48 | $sel_options = array(); |
| 49 | 49 | $readonlys = array(); |
| 50 | 50 | $preserv = array(); |
| 51 | 51 | |
| 52 | - $et = new Etemplate(self::_appname. '.export_dialog'); |
|
| 52 | + $et = new Etemplate(self::_appname.'.export_dialog'); |
|
| 53 | 53 | $_appname = $_content['appname'] ? $_content['appname'] : $_GET['appname']; |
| 54 | 54 | $_definition = $_content['definition'] ? $_content['definition'] : $_GET['definition']; |
| 55 | 55 | $_plugin = $_content['plugin'] ? $_content['plugin'] : $_GET['plugin']; |
| 56 | 56 | // Select all from context menu, means use all search results, not just selected |
| 57 | - if($_GET['select_all'] == 'true') $_GET['selection'] = 'search'; |
|
| 57 | + if ($_GET['select_all'] == 'true') $_GET['selection'] = 'search'; |
|
| 58 | 58 | $_selection = $_content['selection'] ? $_content['selection'] : $_GET['selection']; |
| 59 | - if($_GET['selection'] || $_content['selection_passed']) $content['selection_passed'] = $preserv['selection_passed'] = true; |
|
| 59 | + if ($_GET['selection'] || $_content['selection_passed']) $content['selection_passed'] = $preserv['selection_passed'] = true; |
|
| 60 | 60 | |
| 61 | 61 | // Check global setting |
| 62 | - if(!Api\Storage\Merge::is_export_limit_excepted()) { |
|
| 62 | + if (!Api\Storage\Merge::is_export_limit_excepted()) { |
|
| 63 | 63 | $export_limit = Api\Storage\Merge::getExportLimit($_appname); |
| 64 | - if($export_limit == 'no') { |
|
| 64 | + if ($export_limit == 'no') { |
|
| 65 | 65 | die(lang('Admin disabled exporting')); |
| 66 | 66 | } |
| 67 | 67 | } |
| 68 | 68 | //error_log(__FILE__.__FUNCTION__. '::$_GET[\'appname\']='. $_appname. ',$_GET[\'definition\']='. $_definition. ',$_GET[\'plugin\']='.$_plugin. ',$_GET[\'selection\']='.$_selection); |
| 69 | 69 | // if appname is given and valid, list available definitions (if no definition is given) |
| 70 | - $readonlys['appname'] = (!empty($_appname) && $GLOBALS['egw']->acl->check('run',1,$_appname)); |
|
| 70 | + $readonlys['appname'] = (!empty($_appname) && $GLOBALS['egw']->acl->check('run', 1, $_appname)); |
|
| 71 | 71 | $content['appname'] = $_appname; |
| 72 | 72 | $preserv['appname'] = $_appname; |
| 73 | - if(empty($_appname)) { |
|
| 74 | - $et->setElementAttribute('select_definition','disabled',true); |
|
| 73 | + if (empty($_appname)) { |
|
| 74 | + $et->setElementAttribute('select_definition', 'disabled', true); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | // Check for preferred definition |
| 78 | - if(!$_definition && $_appname) { |
|
| 78 | + if (!$_definition && $_appname) { |
|
| 79 | 79 | $_definition = $GLOBALS['egw_info']['user']['preferences'][$_appname]['nextmatch-export-definition']; |
| 80 | 80 | } |
| 81 | 81 | // fill definitions |
@@ -97,14 +97,14 @@ discard block |
||
| 97 | 97 | } |
| 98 | 98 | unset($definition); |
| 99 | 99 | } |
| 100 | - if(count($sel_options['definition']) == 2 && !$content['definition']) { |
|
| 100 | + if (count($sel_options['definition']) == 2 && !$content['definition']) { |
|
| 101 | 101 | $content['definition'] = end($sel_options['definition']); |
| 102 | 102 | unset($sel_options['definition']['']); |
| 103 | 103 | } |
| 104 | 104 | unset($definitions); |
| 105 | 105 | //$sel_options['definition']['expert'] = lang('Expert options'); |
| 106 | 106 | |
| 107 | - if(isset($_definition) && array_key_exists($_definition,$sel_options['definition'])) { |
|
| 107 | + if (isset($_definition) && array_key_exists($_definition, $sel_options['definition'])) { |
|
| 108 | 108 | $content['definition'] = $_definition; |
| 109 | 109 | } |
| 110 | 110 | |
@@ -112,8 +112,8 @@ discard block |
||
| 112 | 112 | $sel_options['plugin'] = $this->export_plugins[$_appname]['export']; |
| 113 | 113 | |
| 114 | 114 | // show definitions or plugins in ui? |
| 115 | - if($content['definition'] == 'expert') { |
|
| 116 | - if(isset($_plugin) && array_key_exists($_plugin,$sel_options['plugin'])) { |
|
| 115 | + if ($content['definition'] == 'expert') { |
|
| 116 | + if (isset($_plugin) && array_key_exists($_plugin, $sel_options['plugin'])) { |
|
| 117 | 117 | $content['plugin'] = $_plugin; |
| 118 | 118 | $selected_plugin = $_plugin; |
| 119 | 119 | } |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | $readonlys['save_definition'] = true; |
| 132 | 132 | |
| 133 | 133 | $definition = new importexport_definition($content['definition']); |
| 134 | - if($definition) { |
|
| 134 | + if ($definition) { |
|
| 135 | 135 | $content += (array)$definition->plugin_options; |
| 136 | 136 | $selected_plugin = $definition->plugin; |
| 137 | 137 | $content['description'] = $definition->description; |
@@ -148,27 +148,27 @@ discard block |
||
| 148 | 148 | '|' => '|', |
| 149 | 149 | '' => lang('Other') |
| 150 | 150 | ); |
| 151 | - if(!$sel_options['delimiter'][$content['delimiter']]) $sel_options['delimiter'][$content['delimiter']] = $content['delimiter']; |
|
| 152 | - $sel_options['delimiter'][$content['delimiter']] = lang('Use default') . ' "' . $sel_options['delimiter'][$content['delimiter']] . '"'; |
|
| 151 | + if (!$sel_options['delimiter'][$content['delimiter']]) $sel_options['delimiter'][$content['delimiter']] = $content['delimiter']; |
|
| 152 | + $sel_options['delimiter'][$content['delimiter']] = lang('Use default').' "'.$sel_options['delimiter'][$content['delimiter']].'"'; |
|
| 153 | 153 | |
| 154 | - if(!$_content['delimiter']) $et->setElementAttribute('other_delimiter','disabled',true); |
|
| 154 | + if (!$_content['delimiter']) $et->setElementAttribute('other_delimiter', 'disabled', true); |
|
| 155 | 155 | |
| 156 | 156 | // Other delimiter (options) |
| 157 | - if($_content['other_delimiter']) $_content['delimiter'] = $_content['other_delimiter']; |
|
| 157 | + if ($_content['other_delimiter']) $_content['delimiter'] = $_content['other_delimiter']; |
|
| 158 | 158 | |
| 159 | 159 | // handle selector |
| 160 | - if($selected_plugin) { |
|
| 160 | + if ($selected_plugin) { |
|
| 161 | 161 | $content['plugin'] = $selected_plugin; |
| 162 | 162 | $plugin_object = new $selected_plugin; |
| 163 | 163 | |
| 164 | 164 | $content['description'] = $plugin_object->get_description(); |
| 165 | 165 | |
| 166 | 166 | // fill options tab |
| 167 | - if(method_exists($plugin_object, 'get_selectors_html')) { |
|
| 167 | + if (method_exists($plugin_object, 'get_selectors_html')) { |
|
| 168 | 168 | $content['plugin_options_html'] = $plugin_object->get_options_html(); |
| 169 | 169 | } else { |
| 170 | 170 | $options = $plugin_object->get_options_etpl($definition); |
| 171 | - if(is_array($options)) { |
|
| 171 | + if (is_array($options)) { |
|
| 172 | 172 | $content['plugin_options_template'] = $options['name']; |
| 173 | 173 | $content += (array)$options['content']; |
| 174 | 174 | $sel_options += (array)$options['sel_options']; |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | // fill selection tab |
| 184 | - if($definition && is_array($definition->plugin_options) && $definition->plugin_options['selection'] && !$content['selection_passed']) { |
|
| 184 | + if ($definition && is_array($definition->plugin_options) && $definition->plugin_options['selection'] && !$content['selection_passed']) { |
|
| 185 | 185 | $_selection = $definition->plugin_options['selection']; |
| 186 | 186 | } |
| 187 | 187 | |
@@ -191,11 +191,11 @@ discard block |
||
| 191 | 191 | $preserv['selection'] = $_selection; |
| 192 | 192 | } |
| 193 | 193 | elseif ($plugin_object) { |
| 194 | - if(method_exists($plugin_object, 'get_selectors_html')) { |
|
| 194 | + if (method_exists($plugin_object, 'get_selectors_html')) { |
|
| 195 | 195 | $content['plugin_selectors_html'] = $plugin_object->get_selectors_html(); |
| 196 | 196 | } else { |
| 197 | 197 | $options = $plugin_object->get_selectors_etpl($definition); |
| 198 | - if(is_array($options)) { |
|
| 198 | + if (is_array($options)) { |
|
| 199 | 199 | $content += is_array($options['content']) ? $options['content'] : array('selection' => $options['content']); |
| 200 | 200 | $sel_options += (array)$options['sel_options']; |
| 201 | 201 | $readonlys['selection'] = (array)$options['readonlys']; |
@@ -205,12 +205,12 @@ discard block |
||
| 205 | 205 | $content['plugin_selectors_template'] = $options; |
| 206 | 206 | } |
| 207 | 207 | } |
| 208 | - if(!$content['plugin_selectors_html'] && !$content['plugin_selectors_template']) { |
|
| 208 | + if (!$content['plugin_selectors_html'] && !$content['plugin_selectors_template']) { |
|
| 209 | 209 | $readonlys[$tabs]['selection_tab'] = true; |
| 210 | 210 | } |
| 211 | 211 | $content['filter'] = (Array)$definition->filter; |
| 212 | 212 | $content['filter']['fields'] = importexport_helper_functions::get_filter_fields($_appname, $selected_plugin); |
| 213 | - if(!$content['filter']['fields']) |
|
| 213 | + if (!$content['filter']['fields']) |
|
| 214 | 214 | { |
| 215 | 215 | $content['no_filter'] = true; |
| 216 | 216 | } |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | { |
| 229 | 229 | $content['selection'] = 'filter'; |
| 230 | 230 | } |
| 231 | - if(!$content['selection']) |
|
| 231 | + if (!$content['selection']) |
|
| 232 | 232 | { |
| 233 | 233 | $content['selection'] = 'search'; |
| 234 | 234 | } |
@@ -239,33 +239,33 @@ discard block |
||
| 239 | 239 | //error_log(__METHOD__.__LINE__.array2string($apps)); |
| 240 | 240 | if (empty($apps)) throw new Exception('Error: no application profiles available for export'); |
| 241 | 241 | if (!is_array($apps) && $apps) $apps = (array)$apps; |
| 242 | - $sel_options['appname'] = array('' => lang('Select one')) + array_combine($apps,$apps); |
|
| 243 | - if(!$_application && !$selected_plugin) { |
|
| 242 | + $sel_options['appname'] = array('' => lang('Select one')) + array_combine($apps, $apps); |
|
| 243 | + if (!$_application && !$selected_plugin) { |
|
| 244 | 244 | $content['plugin_selectors_html'] = $content['plugin_options_html'] = |
| 245 | 245 | lang('You need to select an app and format first!'); |
| 246 | 246 | $readonlys[$tabs] = array('selection_tab' => true, 'options_tab' => true); |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | - if($_content['preview'] || $_content['export']) |
|
| 249 | + if ($_content['preview'] || $_content['export']) |
|
| 250 | 250 | { |
| 251 | 251 | //error_log(__LINE__.__FILE__.'$_content: '.print_r($_content,true)); |
| 252 | 252 | $response = Api\Json\Response::get(); |
| 253 | 253 | |
| 254 | 254 | if ($_content['definition'] == 'expert') { |
| 255 | 255 | $definition = new importexport_definition(); |
| 256 | - $definition->definition_id = $_content['definition_id'] ? $_content['definition_id'] : ''; |
|
| 256 | + $definition->definition_id = $_content['definition_id'] ? $_content['definition_id'] : ''; |
|
| 257 | 257 | $definition->name = $_content['name'] ? $_content['name'] : ''; |
| 258 | - $definition->application = $_content['appname']; |
|
| 259 | - $definition->plugin = $_content['plugin']; |
|
| 258 | + $definition->application = $_content['appname']; |
|
| 259 | + $definition->plugin = $_content['plugin']; |
|
| 260 | 260 | $definition->type = 'export'; |
| 261 | - $definition->allowed_users = $_content['allowed_users'] ? $_content['allowed_users'] : $this->user; |
|
| 262 | - $definition->owner = $_content['owner'] ? $_content['owner'] : $this->user; |
|
| 261 | + $definition->allowed_users = $_content['allowed_users'] ? $_content['allowed_users'] : $this->user; |
|
| 262 | + $definition->owner = $_content['owner'] ? $_content['owner'] : $this->user; |
|
| 263 | 263 | } |
| 264 | 264 | else { |
| 265 | 265 | $definition = new importexport_definition($_content['definition']); |
| 266 | 266 | } |
| 267 | 267 | |
| 268 | - if(!is_array($definition->plugin_options)) { |
|
| 268 | + if (!is_array($definition->plugin_options)) { |
|
| 269 | 269 | $definition->plugin_options = array( |
| 270 | 270 | 'mapping' => array() |
| 271 | 271 | ); |
@@ -275,30 +275,30 @@ discard block |
||
| 275 | 275 | // Note that because not all dates are DB dates, the plugin has to handle them |
| 276 | 276 | $filter = array(); |
| 277 | 277 | $_content['filter'] = $_content['filter_html'] ? $_content['filter_html'] : $_content['filter_tpl']; |
| 278 | - if(is_array($_content['filter'])) |
|
| 278 | + if (is_array($_content['filter'])) |
|
| 279 | 279 | { |
| 280 | - foreach($_content['filter'] as $key => $value) |
|
| 280 | + foreach ($_content['filter'] as $key => $value) |
|
| 281 | 281 | { |
| 282 | 282 | // Handle multiple values |
| 283 | - if(!is_array($value) && strpos($value,',') !== false) $value = explode(',',$value); |
|
| 283 | + if (!is_array($value) && strpos($value, ',') !== false) $value = explode(',', $value); |
|
| 284 | 284 | |
| 285 | 285 | $filter[$key] = $value; |
| 286 | 286 | |
| 287 | 287 | // Skip empty values or empty ranges |
| 288 | - if($value == "" || is_null($value) || (is_array($value) && count($value) == 0) || is_array($value) && array_key_exists('from',$value) && !$value['from'] && !$value['to'] ) |
|
| 288 | + if ($value == "" || is_null($value) || (is_array($value) && count($value) == 0) || is_array($value) && array_key_exists('from', $value) && !$value['from'] && !$value['to']) |
|
| 289 | 289 | { |
| 290 | 290 | unset($filter[$key]); |
| 291 | 291 | } |
| 292 | - if(is_array($value) && array_key_exists('from', $value) && $value['from']) |
|
| 292 | + if (is_array($value) && array_key_exists('from', $value) && $value['from']) |
|
| 293 | 293 | { |
| 294 | - $filter[$key]['from'] = Api\DateTime::to($value['from'],'ts'); |
|
| 294 | + $filter[$key]['from'] = Api\DateTime::to($value['from'], 'ts'); |
|
| 295 | 295 | } |
| 296 | 296 | // If user selects an end date, they most likely want entries including that date |
| 297 | - if(is_array($value) && array_key_exists('to',$value) && $value['to'] ) |
|
| 297 | + if (is_array($value) && array_key_exists('to', $value) && $value['to']) |
|
| 298 | 298 | { |
| 299 | 299 | // Adjust time to 23:59:59 |
| 300 | 300 | $filter[$key]['to'] = new Api\DateTime($value['to']); |
| 301 | - $filter[$key]['to']->setTime(23,59,59); |
|
| 301 | + $filter[$key]['to']->setTime(23, 59, 59); |
|
| 302 | 302 | $filter[$key]['to'] = $filter[$key]['to']->format('ts'); |
| 303 | 303 | } |
| 304 | 304 | } |
@@ -312,19 +312,19 @@ discard block |
||
| 312 | 312 | $_content |
| 313 | 313 | ); |
| 314 | 314 | |
| 315 | - if(!$definition->plugin_options['selection']) { |
|
| 316 | - $response->alert( lang('No records selected')); |
|
| 315 | + if (!$definition->plugin_options['selection']) { |
|
| 316 | + $response->alert(lang('No records selected')); |
|
| 317 | 317 | return; |
| 318 | 318 | } |
| 319 | 319 | |
| 320 | - $tmpfname = tempnam($GLOBALS['egw_info']['server']['temp_dir'],'export'); |
|
| 320 | + $tmpfname = tempnam($GLOBALS['egw_info']['server']['temp_dir'], 'export'); |
|
| 321 | 321 | $file = fopen($tmpfname, "w+"); |
| 322 | - if (! $charset = $definition->plugin_options['charset']) { |
|
| 322 | + if (!$charset = $definition->plugin_options['charset']) { |
|
| 323 | 323 | $charset = Api\Translation::charset(); |
| 324 | 324 | } |
| 325 | - if($charset == 'user') |
|
| 325 | + if ($charset == 'user') |
|
| 326 | 326 | { |
| 327 | - switch($definition->plugin) |
|
| 327 | + switch ($definition->plugin) |
|
| 328 | 328 | { |
| 329 | 329 | case 'addressbook_export_vcard': |
| 330 | 330 | $charset = $GLOBALS['egw_info']['user']['preferences']['addressbook']['vcard_charset']; |
@@ -334,9 +334,9 @@ discard block |
||
| 334 | 334 | } |
| 335 | 335 | } |
| 336 | 336 | $plugin_object = new $definition->plugin; |
| 337 | - $result = $plugin_object->export( $file, $definition ); |
|
| 337 | + $result = $plugin_object->export($file, $definition); |
|
| 338 | 338 | |
| 339 | - if(is_object($result) && method_exists($result, 'get_num_of_records')) |
|
| 339 | + if (is_object($result) && method_exists($result, 'get_num_of_records')) |
|
| 340 | 340 | { |
| 341 | 341 | $record_count = $result->get_num_of_records(); |
| 342 | 342 | } |
@@ -344,7 +344,7 @@ discard block |
||
| 344 | 344 | // Store charset to use in header |
| 345 | 345 | Api\Cache::setSession('importexport', $tmpfname, $charset, 100); |
| 346 | 346 | |
| 347 | - if($_content['export'] == 'pressed') { |
|
| 347 | + if ($_content['export'] == 'pressed') { |
|
| 348 | 348 | fclose($file); |
| 349 | 349 | $filename = pathinfo($tmpfname, PATHINFO_FILENAME); |
| 350 | 350 | $link_query = array( |
@@ -356,25 +356,25 @@ discard block |
||
| 356 | 356 | ); |
| 357 | 357 | |
| 358 | 358 | // Allow plugins to suggest a file name - return false if they have no suggestion |
| 359 | - if(method_exists($plugin_object, 'get_filename') && $plugin_filename = $plugin_object->get_filename()) |
|
| 359 | + if (method_exists($plugin_object, 'get_filename') && $plugin_filename = $plugin_object->get_filename()) |
|
| 360 | 360 | { |
| 361 | 361 | $link_query['filename'] = $plugin_filename; |
| 362 | 362 | } |
| 363 | - $response->redirect( $GLOBALS['egw']->link('/index.php',$link_query),true); |
|
| 363 | + $response->redirect($GLOBALS['egw']->link('/index.php', $link_query), true); |
|
| 364 | 364 | Framework::window_close(); |
| 365 | 365 | return; |
| 366 | 366 | } |
| 367 | - elseif($_content['preview'] == 'pressed') { |
|
| 367 | + elseif ($_content['preview'] == 'pressed') { |
|
| 368 | 368 | fseek($file, 0); |
| 369 | 369 | $item_count = 1; |
| 370 | 370 | $preview = ''; |
| 371 | - $search = array('[\016]','[\017]', |
|
| 372 | - '[\020]','[\021]','[\022]','[\023]','[\024]','[\025]','[\026]','[\027]', |
|
| 373 | - '[\030]','[\031]','[\032]','[\033]','[\034]','[\035]','[\036]','[\037]'); |
|
| 371 | + $search = array('[\016]', '[\017]', |
|
| 372 | + '[\020]', '[\021]', '[\022]', '[\023]', '[\024]', '[\025]', '[\026]', '[\027]', |
|
| 373 | + '[\030]', '[\031]', '[\032]', '[\033]', '[\034]', '[\035]', '[\036]', '[\037]'); |
|
| 374 | 374 | $replace = $preview = ''; |
| 375 | 375 | |
| 376 | - while(!feof($file) && $item_count < 30) { |
|
| 377 | - $preview .= preg_replace($search,$replace,fgets($file,1024)); |
|
| 376 | + while (!feof($file) && $item_count < 30) { |
|
| 377 | + $preview .= preg_replace($search, $replace, fgets($file, 1024)); |
|
| 378 | 378 | $item_count++; |
| 379 | 379 | } |
| 380 | 380 | |
@@ -382,12 +382,12 @@ discard block |
||
| 382 | 382 | unlink($tmpfname); |
| 383 | 383 | |
| 384 | 384 | // Convert back to system charset for display |
| 385 | - $preview = Api\Translation::convert( $preview, |
|
| 385 | + $preview = Api\Translation::convert($preview, |
|
| 386 | 386 | $charset, |
| 387 | 387 | Api\Translation::charset() |
| 388 | 388 | ); |
| 389 | 389 | |
| 390 | - $preview = "<div class='header'>".lang('Preview') . "<span class='count'>".(int)$record_count."</span></div>".$preview; |
|
| 390 | + $preview = "<div class='header'>".lang('Preview')."<span class='count'>".(int)$record_count."</span></div>".$preview; |
|
| 391 | 391 | |
| 392 | 392 | $et->setElementAttribute('preview-box', 'value', nl2br($preview)); |
| 393 | 393 | return; |
@@ -399,7 +399,7 @@ discard block |
||
| 399 | 399 | $readonlys[$tabs]['selection'] = false; |
| 400 | 400 | } |
| 401 | 401 | //error_log(print_r($content,true)); |
| 402 | - return $et->exec(self::_appname. '.importexport_export_ui.export_dialog',$content,$sel_options,$readonlys,$preserv,2); |
|
| 402 | + return $et->exec(self::_appname.'.importexport_export_ui.export_dialog', $content, $sel_options, $readonlys, $preserv, 2); |
|
| 403 | 403 | } |
| 404 | 404 | |
| 405 | 405 | public function ajax_get_definition_description($_definition) { |
@@ -414,7 +414,7 @@ discard block |
||
| 414 | 414 | } |
| 415 | 415 | unset ($_object); |
| 416 | 416 | } |
| 417 | - $_response->assign('importexport-export_dialog_plugin_description','innerHTML',$description); |
|
| 417 | + $_response->assign('importexport-export_dialog_plugin_description', 'innerHTML', $description); |
|
| 418 | 418 | } |
| 419 | 419 | |
| 420 | 420 | public function ajax_get_plugin_description($_plugin) { |
@@ -424,7 +424,7 @@ discard block |
||
| 424 | 424 | if (is_a($plugin_object, 'importexport_iface_export_plugin')) { |
| 425 | 425 | $description = $plugin_object->get_description(); |
| 426 | 426 | } |
| 427 | - $_response->addAssign('importexport-export_dialog_plugin_description','innerHTML',$description); |
|
| 427 | + $_response->addAssign('importexport-export_dialog_plugin_description', 'innerHTML', $description); |
|
| 428 | 428 | |
| 429 | 429 | unset ($plugin_object); |
| 430 | 430 | } |
@@ -437,7 +437,7 @@ discard block |
||
| 437 | 437 | */ |
| 438 | 438 | public function download($_tmpfname = '') { |
| 439 | 439 | $tmpfname = $_tmpfname ? $_tmpfname : $_GET['_filename']; |
| 440 | - $tmpfname = $GLOBALS['egw_info']['server']['temp_dir'] .'/'. $tmpfname; |
|
| 440 | + $tmpfname = $GLOBALS['egw_info']['server']['temp_dir'].'/'.$tmpfname; |
|
| 441 | 441 | if (!is_readable($tmpfname)) die(); |
| 442 | 442 | |
| 443 | 443 | $appname = $_GET['_appname']; |
@@ -446,13 +446,13 @@ discard block |
||
| 446 | 446 | // Turn off all output buffering |
| 447 | 447 | while (@ob_end_clean()); |
| 448 | 448 | |
| 449 | - $file = fopen($tmpfname,'rb'); |
|
| 449 | + $file = fopen($tmpfname, 'rb'); |
|
| 450 | 450 | |
| 451 | 451 | // Get charset |
| 452 | 452 | $charset = Api\Cache::getSession('importexport', $tmpfname); |
| 453 | 453 | |
| 454 | 454 | Api\Header\Content::type($nicefname.'.'.$_GET['_suffix'], |
| 455 | - ($_GET['_type'] ? $_GET['_type'] : 'application/text') . ($charset ? '; charset='.$charset : ''), |
|
| 455 | + ($_GET['_type'] ? $_GET['_type'] : 'application/text').($charset ? '; charset='.$charset : ''), |
|
| 456 | 456 | filesize($tmpfname)); |
| 457 | 457 | fpassthru($file); |
| 458 | 458 | |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | * @param boolean $clear_includes =false true: clear all previous includes |
| 35 | 35 | * @return boolean false: css file not found, true: file found |
| 36 | 36 | */ |
| 37 | - public static function add($app, $name=null, $append=true, $clear_includes=false) |
|
| 37 | + public static function add($app, $name = null, $append = true, $clear_includes = false) |
|
| 38 | 38 | { |
| 39 | 39 | if ($clear_includes) |
| 40 | 40 | { |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | if (!is_null($name)) |
| 45 | 45 | { |
| 46 | - foreach($GLOBALS['egw']->framework->template_dirs as $dir) |
|
| 46 | + foreach ($GLOBALS['egw']->framework->template_dirs as $dir) |
|
| 47 | 47 | { |
| 48 | 48 | if (file_exists(EGW_SERVER_ROOT.($path = '/'.$app.'/templates/'.$dir.'/'.$name.'.css'))) |
| 49 | 49 | { |
@@ -55,12 +55,12 @@ discard block |
||
| 55 | 55 | { |
| 56 | 56 | $path = $app; |
| 57 | 57 | } |
| 58 | - if (!file_exists(EGW_SERVER_ROOT.$path) && !file_exists(EGW_SERVER_ROOT . parse_url($path,PHP_URL_PATH))) |
|
| 58 | + if (!file_exists(EGW_SERVER_ROOT.$path) && !file_exists(EGW_SERVER_ROOT.parse_url($path, PHP_URL_PATH))) |
|
| 59 | 59 | { |
| 60 | 60 | //error_log(__METHOD__."($app,$name) $path NOT found!"); |
| 61 | 61 | return false; |
| 62 | 62 | } |
| 63 | - if (!in_array($path,self::$files)) |
|
| 63 | + if (!in_array($path, self::$files)) |
|
| 64 | 64 | { |
| 65 | 65 | if ($append) |
| 66 | 66 | { |
@@ -79,16 +79,16 @@ discard block |
||
| 79 | 79 | * |
| 80 | 80 | * @return string |
| 81 | 81 | */ |
| 82 | - public static function get($resolve=false) |
|
| 82 | + public static function get($resolve = false) |
|
| 83 | 83 | { |
| 84 | 84 | if (!$resolve) |
| 85 | 85 | { |
| 86 | 86 | return self::$files; |
| 87 | 87 | } |
| 88 | 88 | $files = array(); |
| 89 | - foreach(self::$files as $path) |
|
| 89 | + foreach (self::$files as $path) |
|
| 90 | 90 | { |
| 91 | - foreach(self::resolve_css_includes($path) as $path) |
|
| 91 | + foreach (self::resolve_css_includes($path) as $path) |
|
| 92 | 92 | { |
| 93 | 93 | $files[] = $path; |
| 94 | 94 | } |
@@ -109,11 +109,11 @@ discard block |
||
| 109 | 109 | $base_path = $GLOBALS['egw_info']['server']['webserver_url']; |
| 110 | 110 | if ($base_path[0] != '/') $base_path = parse_url($base_path, PHP_URL_PATH); |
| 111 | 111 | $css_files = ''; |
| 112 | - foreach(self::$files as $path) |
|
| 112 | + foreach (self::$files as $path) |
|
| 113 | 113 | { |
| 114 | - foreach(self::resolve_css_includes($path) as $path) |
|
| 114 | + foreach (self::resolve_css_includes($path) as $path) |
|
| 115 | 115 | { |
| 116 | - list($file,$query) = explode('?',$path,2); |
|
| 116 | + list($file, $query) = explode('?', $path, 2); |
|
| 117 | 117 | if (($mod = filemtime(EGW_SERVER_ROOT.$file)) > $max_modified) $max_modified = $mod; |
| 118 | 118 | |
| 119 | 119 | // do NOT include app.css or categories.php, as it changes from app to app |
@@ -147,20 +147,20 @@ discard block |
||
| 147 | 147 | * @param string $path EGroupware relative path eg. /phpgwapi/templates/default/some.css |
| 148 | 148 | * @return array parsed pathes (EGroupware relative) including $path itself |
| 149 | 149 | */ |
| 150 | - protected static function resolve_css_includes($path, &$pathes=array()) |
|
| 150 | + protected static function resolve_css_includes($path, &$pathes = array()) |
|
| 151 | 151 | { |
| 152 | 152 | $matches = null; |
| 153 | 153 | |
| 154 | - list($file) = explode('?',$path,2); |
|
| 155 | - if (($to_check = file_get_contents (EGW_SERVER_ROOT.$file, false, null, 0, 1024)) && |
|
| 154 | + list($file) = explode('?', $path, 2); |
|
| 155 | + if (($to_check = file_get_contents(EGW_SERVER_ROOT.$file, false, null, 0, 1024)) && |
|
| 156 | 156 | stripos($to_check, '/*@import') !== false && preg_match_all('|/\*@import url\("([^"]+)"|i', $to_check, $matches)) |
| 157 | 157 | { |
| 158 | - foreach($matches[1] as $import_path) |
|
| 158 | + foreach ($matches[1] as $import_path) |
|
| 159 | 159 | { |
| 160 | 160 | if ($import_path[0] != '/') |
| 161 | 161 | { |
| 162 | 162 | $dir = dirname($path); |
| 163 | - while(substr($import_path,0,3) == '../') |
|
| 163 | + while (substr($import_path, 0, 3) == '../') |
|
| 164 | 164 | { |
| 165 | 165 | $dir = dirname($dir); |
| 166 | 166 | $import_path = substr($import_path, 3); |