Exemplo n.º 1
0
 function axiom_ini_get_values($file)
 {
     $rez = array();
     if (!is_array($file)) {
         if (file_exists($file)) {
             $file = axiom_fga($file);
         } else {
             return $rez;
         }
     }
     for ($i = 0; $i < count($file); $i++) {
         $file[$i] = trim(chop($file[$i]));
         if (($pos = axiom_strpos($file[$i], ';')) !== false) {
             $file[$i] = trim(axiom_substr($file[$i], 0, $pos));
         }
         $parts = explode('=', $file[$i]);
         if (count($parts) != 2) {
             continue;
         }
         $key = trim(chop($parts[0]));
         $rez[$key] = trim($parts[1]);
         if (axiom_substr($rez[$key], 0, 1) == '"') {
             $rez[$key] = axiom_substr($rez[$key], 1, axiom_strlen($rez[$key]) - 2);
         } else {
             $rez[$key] *= 1;
         }
     }
     return $rez;
 }
Exemplo n.º 2
0
 function load_po($suffix = '')
 {
     $rez = array('data' => '', 'error' => '');
     do {
         // Upload file
         if ($_POST['po_src' . trim($suffix)] == 'upload_') {
             $rez['data'] = isset($_FILES['po_file' . $suffix]['tmp_name']) && file_exists($_FILES['po_file' . $suffix]['tmp_name']) ? axiom_fga($_FILES['po_file' . $suffix]['tmp_name']) : '';
             if (empty($rez['data'])) {
                 $rez['error'] = sprintf(__('Error uploading or Empty .po-file: %s', 'axiom'), $_FILES['po_file' . $suffix]['tmp_name']);
                 break;
             }
             // or get content from textarea
         } else {
             if (!empty($_POST['po_text' . $suffix])) {
                 if (!empty($_POST['po_text' . $suffix])) {
                     $rez['data'] = explode("\n", stripslashes($_POST['po_text' . $suffix]));
                 } else {
                     $rez['error'] = __('Empty textarea with .po-file content!', 'axiom');
                     break;
                 }
                 // or load file from 'languages' folder
             } else {
                 if (substr($_POST['po_src' . $suffix], 0, 7) == 'parent_' || substr($_POST['po_src' . $suffix], 0, 6) == 'child_') {
                     $dir = substr($_POST['po_src' . $suffix], 0, 7) == 'parent_' ? $this->tpl_dir : $this->css_dir;
                     $name = axiom_esc(substr($_POST['po_src' . $suffix], strpos($_POST['po_src' . $suffix], '_') + 1));
                     $rez['data'] = file_exists($dir . '/' . $name . '.po') ? axiom_fga($dir . '/' . $name . '.po') : '';
                     if (empty($rez['data'])) {
                         $rez['error'] = sprintf(__('Error loading or Empty .po-file: %s', 'axiom'), $dir . '/' . $name . '.po');
                         break;
                     }
                     // 'Edit' selected, but textarea is empty
                 } else {
                     $rez['error'] = __('Empty textarea with .po-file content!', 'axiom');
                 }
             }
         }
     } while (false);
     return $rez;
 }
Exemplo n.º 3
0
 function axiom_get_css_selector_property($css, $selector, $prop)
 {
     $rez = '';
     if (!file_exists($css)) {
         return $rez;
     }
     $file = axiom_fga($css);
     foreach ($file as $row) {
         if (($pos = axiom_strpos($row, $selector)) === false) {
             continue;
         }
         if (($pos2 = axiom_strpos($row, $prop . ':', $pos)) !== false && ($pos3 = axiom_strpos($row, ';', $pos2)) !== false && $pos2 < $pos3) {
             $rez = trim(chop(axiom_substr($row, $pos2 + axiom_strlen($prop) + 1, $pos3 - $pos2 - axiom_strlen($prop) - 1)));
             break;
         }
     }
     return $rez;
 }