| 33 | | |
| | 33 | /** |
| | 34 | * Converti un "path" en "path_array". |
| | 35 | * Permet de retrouver un équivalent de $node.path_array là où il n'y a que |
| | 36 | * les informations path, par exemple dans le pagelayout ($module_result.path). |
| | 37 | * |
| | 38 | * @author Guillaume Kulakowski <guillaume_AT_llaumgui_DOT_com> |
| | 39 | * @since 1.0 |
| | 40 | * |
| | 41 | * @param array $path |
| | 42 | * @return array |
| | 43 | */ |
| | 44 | static function path2PathArray( $path ) |
| | 45 | { |
| | 46 | $path_array = array(); |
| | 47 | if ( !is_array( $path ) ) |
| | 48 | return array(); |
| | 49 | |
| | 50 | foreach ( $path as $p ) |
| | 51 | { |
| | 52 | $path_array[]=$p['node_id']; |
| | 53 | } |
| | 54 | return $path_array; |
| | 55 | } |
| | 56 | |
| | 57 | |
| | 58 | |
| | 59 | /** |
| | 60 | * Fonction header() de php mise en forme pour faire des redirections. |
| | 61 | * |
| | 62 | * @author Guillaume Kulakowski <guillaume_AT_llaumgui_DOT_com> |
| | 63 | * @since 1.0 |
| | 64 | * |
| | 65 | * @param string $url URL de redirection |
| | 66 | * @param integer $type Type de redirection |
| | 67 | */ |
| | 68 | static function redirect( $url, $type ) |
| | 69 | { |
| | 70 | switch( $type ) |
| | 71 | { |
| | 72 | case 301: |
| | 73 | header("HTTP/1.1 301 Moved Permanently"); |
| | 74 | break; |
| | 75 | case 307: |
| | 76 | header("HTTP/1.1 307 Temporary Redirect"); |
| | 77 | break; |
| | 78 | } |
| | 79 | header ('location: '.$url); |
| | 80 | eZExecution::cleanExit(); |
| | 81 | } |
| | 82 | |
| | 83 | |
| | 84 | |