Changeset 14393
- Timestamp:
- 01/13/08 20:31:01 (9 months ago)
- Files:
-
- trunk/midcom/midcom.core/globals.php (modified) (1 diff)
- trunk/midcom/midcom.core/midcom/helper/misc.php (modified) (5 diffs)
- trunk/midcom/midcom.helper.filesync/importer/snippet.php (modified) (11 diffs)
- trunk/midcom/midcom.helper.filesync/importer/style.php (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/midcom/midcom.core/globals.php
r14083 r14393 28 28 * error reporting level to something above MIDCOM_LOG_DEBUG. 29 29 * 30 * @global midcom_ helper_debug $GLOBALS['midcom_debugger']30 * @global midcom_debug $GLOBALS['midcom_debugger'] 31 31 */ 32 32 $GLOBALS['midcom_debugger'] = null; trunk/midcom/midcom.core/midcom/helper/misc.php
r14381 r14393 278 278 * <b>Note:</b> This function is quite slow. It does everything on a PHP level. 279 279 * 280 * @param Array $array The ID-Array to sort.280 * @param Array &$array The ID-Array to sort. 281 281 * @param string $sortkey The name of the member that should be sorted (prepend "reverse" for a reverse sorting). 282 282 * @param string $object_type The type of the object referenced by the IDs … … 330 330 * Works with a reference array (doesn't return anything) 331 331 * 332 * @param Array $array The object-array to sort (used via reference).332 * @param Array &$array The object-array to sort (used via reference). 333 333 * @param string $sortkey The name of the member that should be sorted (prepend "reverse" for a reverse sorting). 334 334 * @param int $sorting The PHP sorting mechanism to use. … … 462 462 * 463 463 * @param MidgardObject $object The object at which to save the data. 464 * @param mixed $var The variable that should be saved.464 * @param mixed &$var The variable that should be saved. 465 465 * @param string $name The identifier to use for storage. 466 466 * @return boolean Indicating success. … … 643 643 * It is recommended to use imagemagick in favor of this function. 644 644 * 645 * @param int $dst_img Destination Image Handle.646 * @param int $src_img Source image Handle.645 * @param int &$dst_img Destination Image Handle. 646 * @param int &$src_img Source image Handle. 647 647 * @param int $dst_x X-offest of the destination. 648 648 * @param int $dst_y Y-offest of the destination. … … 717 717 * It is recommended to use imagemagick in favor of this function. 718 718 * 719 * @param int $dst_img Destination Image Handle.720 * @param int $src_img Source image Handle.719 * @param int &$dst_img Destination Image Handle. 720 * @param int &$src_img Source image Handle. 721 721 * @param int $dst_x X-offest of the destination. 722 722 * @param int $dst_y Y-offest of the destination. trunk/midcom/midcom.helper.filesync/importer/snippet.php
r13895 r14393 9 9 10 10 /** 11 * Export a site snippet tothe format used by Site Wizard11 * Import a site snippet from the format used by Site Wizard 12 12 * 13 13 * @package midcom.helper.filesync … … 16 16 { 17 17 var $root_dir = ''; 18 18 19 19 function midcom_helper_filesync_importer_snippet() 20 20 { 21 21 parent::midcom_helper_filesync_importer(); 22 22 23 23 $this->root_dir = midcom_helper_filesync_interface::prepare_dir('snippets'); 24 24 } 25 25 26 26 function read_snippetdir($path, $parent_id) 27 27 { 28 28 $snippetdir_name = basename($path); 29 29 30 30 $object_qb = midcom_baseclasses_database_snippetdir::new_query_builder(); 31 31 $object_qb->add_constraint('up', '=', $parent_id); … … 48 48 } 49 49 50 $directory = dir($path); 51 while (false !== ($entry = $directory->read())) 50 $directory = dir($path); 51 while (false !== ($entry = $directory->read())) 52 52 { 53 53 if (substr($entry, 0, 1) == '.') … … 56 56 continue; 57 57 } 58 58 59 59 if (is_dir("{$path}/{$entry}")) 60 60 { … … 62 62 $this->read_snippetdir("{$path}/{$entry}", $snippetdir->id); 63 63 } 64 64 65 65 // Check file type 66 66 $filename_parts = explode('.', $entry); … … 84 84 continue; 85 85 } 86 86 87 87 // Deal with element 88 88 $file_contents = file_get_contents("{$path}/{$entry}"); … … 92 92 $file_contents = @iconv($encoding, 'UTF-8', $file_contents); 93 93 } 94 94 95 95 $qb = midcom_baseclasses_database_snippet::new_query_builder(); 96 96 $qb->add_constraint('up', '=', $snippetdir->id); … … 109 109 $snippets = $qb->execute(); 110 110 $snippet = $snippets[0]; 111 111 112 112 // Update existing elements only if they have actually changed 113 113 if ($snippet->$field != $file_contents) … … 119 119 $directory->close(); 120 120 } 121 121 122 122 function read_dirs($path) 123 123 { 124 $directory = dir($path); 125 while (false !== ($entry = $directory->read())) 124 $directory = dir($path); 125 while (false !== ($entry = $directory->read())) 126 126 { 127 127 if (substr($entry, 0, 1) == '.') … … 130 130 continue; 131 131 } 132 132 133 133 if (is_dir("{$path}/{$entry}")) 134 134 { … … 139 139 $directory->close(); 140 140 } 141 141 142 142 function import() 143 143 { trunk/midcom/midcom.helper.filesync/importer/style.php
r13895 r14393 9 9 10 10 /** 11 * Export a site style tothe format used by Site Wizard11 * Import a site style from the format used by Site Wizard 12 12 * 13 13 * @package midcom.helper.filesync … … 16 16 { 17 17 var $root_dir = ''; 18 18 19 19 function midcom_helper_filesync_importer_style() 20 20 { 21 21 parent::midcom_helper_filesync_importer(); 22 22 23 23 $this->root_dir = midcom_helper_filesync_interface::prepare_dir('style'); 24 24 } 25 25 26 26 function read_style($path, $parent_id) 27 27 { 28 28 $style_name = basename($path); 29 29 30 30 $object_qb = midcom_db_style::new_query_builder(); 31 31 $object_qb->add_constraint('up', '=', $parent_id); … … 48 48 } 49 49 50 $directory = dir($path); 51 while (false !== ($entry = $directory->read())) 50 $directory = dir($path); 51 while (false !== ($entry = $directory->read())) 52 52 { 53 53 if (substr($entry, 0, 1) == '.') … … 56 56 continue; 57 57 } 58 58 59 59 if (is_dir("{$path}/{$entry}")) 60 60 { … … 62 62 $this->read_style("{$path}/{$entry}", $style->id); 63 63 } 64 64 65 65 // Deal with element 66 66 67 67 // Check file type 68 68 $filename_parts = explode('.', $entry); … … 83 83 continue; 84 84 } 85 85 86 86 $file_contents = file_get_contents("{$path}/{$entry}"); 87 87 $encoding = mb_detect_encoding($file_contents); … … 90 90 $file_contents = @iconv($encoding, 'UTF-8', $file_contents); 91 91 } 92 92 93 93 $qb = midcom_db_element::new_query_builder(); 94 94 $qb->add_constraint('style', '=', $style->id); … … 107 107 $elements = $qb->execute(); 108 108 $element = $elements[0]; 109 109 110 110 // Update existing elements only if they have actually changed 111 111 if ($element->$field != $file_contents) … … 117 117 $directory->close(); 118 118 } 119 119 120 120 function read_styledir($path) 121 121 { 122 $directory = dir($path); 123 while (false !== ($entry = $directory->read())) 122 $directory = dir($path); 123 while (false !== ($entry = $directory->read())) 124 124 { 125 125 if (substr($entry, 0, 1) == '.') … … 128 128 continue; 129 129 } 130 130 131 131 if (is_dir("{$path}/{$entry}")) 132 132 { … … 137 137 $directory->close(); 138 138 } 139 139 140 140 function import() 141 141 {
