Exemplo n.º 1
0
function hm_array_to_list($key = '', $val = array(), $prefix = '')
{
    $return[] = $prefix . $key . " : \n";
    if (is_array($val)) {
        $prefix = $prefix . '-';
        foreach ($val as $sub_key => $sub_val) {
            if (is_array($sub_val)) {
                $new_prefix = $prefix . '-';
                $return[] = "\t" . hm_array_to_list($sub_key, $sub_val, $new_prefix);
            } else {
                $return[] = "\t" . $prefix . $sub_key . " : " . $sub_val . "\n";
            }
        }
    }
    return implode('', $return);
}
 public function content($parameter1 = NULL, $parameter2 = NULL)
 {
     switch ($parameter1) {
         case 'type':
             global $hmcontent;
             if (isset($parameter2)) {
                 $con = $hmcontent->hmcontent;
                 if (isset($con[$parameter2])) {
                     $args = $con[$parameter2];
                     foreach ($args as $key => $val) {
                         if (is_array($val)) {
                             $return[] = "\t" . hm_array_to_list($key, $val);
                         } else {
                             $return[] = "\t" . $key . " : " . $val . "\n";
                         }
                     }
                     return implode('', $return);
                 }
             } else {
                 $content_type = $hmcontent->hmcontent;
                 foreach ($content_type as $key => $val) {
                     $return[] = "\t" . $key . "\n";
                 }
                 return implode('', $return);
             }
             break;
         default:
             $help = "\tcontent type : " . _('Hiển thị tất cả content type') . "\n" . "\tcontent type ['content key'] : " . _('Hiển thị chi tiết content type') . "\n" . "" . "\n";
             return $help;
     }
 }