当前位置: 首页>>代码示例>>PHP>>正文


PHP doArray函数代码示例

本文整理汇总了PHP中doArray函数的典型用法代码示例。如果您正苦于以下问题:PHP doArray函数的具体用法?PHP doArray怎么用?PHP doArray使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了doArray函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getPost

 /**
  * Gets a HTTP post parameter.
  *
  * @param  string $name The parameter name
  * @return mixed
  */
 public function getPost($name)
 {
     $out = '';
     if (isset($_POST[$name])) {
         $out = $_POST[$name];
         if ($this->magicQuotesGpc) {
             $out = doStrip($out);
         }
     }
     return doArray($out, 'deNull');
 }
开发者ID:ClaireBrione,项目名称:textpattern,代码行数:17,代码来源:Request.php

示例2: quote_list

function quote_list($in)
{
    $out = doSlash($in);
    return doArray($out, 'doQuote');
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:5,代码来源:txplib_misc.php

示例3: db_column_list

function db_column_list($tbl, $res = 0)
{
    global $mdb_res;
    $res = $res ? $res : $mdb_res;
    /* @var $res PDO */
    $st = $res->query("SELECT * FROM {$tbl} LIMIT 1");
    /* @var $res PDOStatement */
    $c = $st->columnCount();
    if ($c > 0) {
        for ($i = 0; $i < $c; $i++) {
            $meta = $st->getColumnMeta($i);
            $cols[$meta['name']] = $meta['sqlite:decl_type'];
        }
        # getColumnMeta does not work with empty tables:
        if (sizeof($cols) != $c) {
            unset($cols);
            $st2 = $res->query("SELECT sql FROM sqlite_master WHERE type='table' AND tbl_name='{$tbl}'");
            /* @var $st PDOStatement */
            if ($st2 !== false) {
                $sql = $st2->fetch(PDO::FETCH_ASSOC);
                extract($sql);
                $sql = substr($sql, strpos($sql, '(') + 1);
                $cls = explode(',', $sql);
                $cls = doArray($cls, 'trim');
                foreach ($cls as $val) {
                    $col = explode(' ', $val);
                    $cols[$col[0]] = $col[1];
                }
                # remove any primary key sentence and keep the lenght equal to the columns number
                $cols = array_slice($cols, 0, $c);
            }
        }
    }
    return $cols ? $cols : array();
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:35,代码来源:pdo_sqlite.php

示例4: doSpecial

function doSpecial($in)
{
    return doArray($in, 'htmlspecialchars');
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:4,代码来源:txplib_misc.php

示例5: article_validate

/**
 * Validates article data.
 *
 * @param  array        $rs  Article data
 * @param  string|array $msg Initial message
 * @return string HTML
 */
function article_validate($rs, &$msg)
{
    global $prefs, $step, $statuses;
    if (!empty($msg)) {
        return false;
    }
    $constraints = array('Status' => new ChoiceConstraint($rs['Status'], array('choices' => array_keys($statuses), 'message' => 'invalid_status')), 'Section' => new SectionConstraint($rs['Section']), 'Category1' => new CategoryConstraint($rs['Category1'], array('type' => 'article')), 'Category2' => new CategoryConstraint($rs['Category2'], array('type' => 'article')), 'textile_body' => new \Textpattern\Textfilter\Constraint($rs['textile_body'], array('message' => 'invalid_textfilter_body')), 'textile_excerpt' => new \Textpattern\Textfilter\Constraint($rs['textile_excerpt'], array('message' => 'invalid_textfilter_excerpt')));
    if (!$prefs['articles_use_excerpts']) {
        $constraints['excerpt_blank'] = new BlankConstraint($rs['Excerpt'], array('message' => 'excerpt_not_blank'));
    }
    if (!$prefs['use_comments']) {
        $constraints['annotate_invite_blank'] = new BlankConstraint($rs['AnnotateInvite'], array('message' => 'invite_not_blank'));
        $constraints['annotate_false'] = new FalseConstraint($rs['Annotate'], array('message' => 'comments_are_on'));
    }
    if ($prefs['allow_form_override']) {
        $constraints['override_form'] = new FormConstraint($rs['override_form'], array('type' => 'article'));
    } else {
        $constraints['override_form'] = new BlankConstraint($rs['override_form'], array('message' => 'override_form_not_blank'));
    }
    callback_event_ref('article_ui', "validate_{$step}", 0, $rs, $constraints);
    $validator = new Validator($constraints);
    if ($validator->validate()) {
        $msg = '';
        return true;
    } else {
        $msg = doArray($validator->getMessages(), 'gTxt');
        $msg = array(join(', ', $msg), E_ERROR);
        return false;
    }
}
开发者ID:ClaireBrione,项目名称:textpattern,代码行数:37,代码来源:txp_article.php

示例6: undoSlash

function undoSlash($in)
{
    return doArray($in, 'stripslashes');
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:4,代码来源:import_wp.php

示例7: sDoSlash

function sDoSlash($in)
{
    if (phpversion() >= "4.3.0") {
        return doArray($in, 'mysql_real_escape_string');
    } else {
        return doArray($in, 'mysql_escape_string');
    }
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:8,代码来源:index.php

示例8: file_download_list

function file_download_list($atts, $thing = NULL)
{
    global $s, $c, $context, $thisfile, $thispage, $pretext;
    extract(lAtts(array('break' => br, 'category' => '', 'author' => '', 'realname' => '', 'auto_detect' => 'category, author', 'class' => __FUNCTION__, 'form' => 'files', 'id' => '', 'label' => '', 'labeltag' => '', 'pageby' => '', 'limit' => 10, 'offset' => 0, 'sort' => 'filename asc', 'wraptag' => '', 'status' => '4'), $atts));
    if (!is_numeric($status)) {
        $status = getStatusNum($status);
    }
    // N.B. status treated slightly differently
    $where = $statwhere = array();
    $filters = isset($atts['id']) || isset($atts['category']) || isset($atts['author']) || isset($atts['realname']) || isset($atts['status']);
    $context_list = empty($auto_detect) || $filters ? array() : do_list($auto_detect);
    $pageby = $pageby == 'limit' ? $limit : $pageby;
    if ($category) {
        $where[] = "category IN ('" . join("','", doSlash(do_list($category))) . "')";
    }
    $ids = array_map('intval', do_list($id));
    if ($id) {
        $where[] = "id IN ('" . join("','", $ids) . "')";
    }
    if ($status) {
        $statwhere[] = "status = '" . doSlash($status) . "'";
    }
    if ($author) {
        $where[] = "author IN ('" . join("','", doSlash(do_list($author))) . "')";
    }
    if ($realname) {
        $authorlist = safe_column('name', 'txp_users', "RealName IN ('" . join("','", doArray(doSlash(do_list($realname)), 'urldecode')) . "')");
        $where[] = "author IN ('" . join("','", doSlash($authorlist)) . "')";
    }
    // If no files are selected, try...
    if (!$where && !$filters) {
        foreach ($context_list as $ctxt) {
            switch ($ctxt) {
                case 'category':
                    // ... the global category in the URL
                    if ($context == 'file' && !empty($c)) {
                        $where[] = "category = '" . doSlash($c) . "'";
                    }
                    break;
                case 'author':
                    // ... the global author in the URL
                    if ($context == 'file' && !empty($pretext['author'])) {
                        $where[] = "author = '" . doSlash($pretext['author']) . "'";
                    }
                    break;
            }
            // Only one context can be processed
            if ($where) {
                break;
            }
        }
    }
    if (!$where && !$statwhere && $filters) {
        return '';
        // If nothing matches, output nothing
    }
    if (!$where) {
        $where[] = "1=1";
        // If nothing matches, start with all files
    }
    $where = join(' AND ', array_merge($where, $statwhere));
    // Set up paging if required
    if ($limit && $pageby) {
        $grand_total = safe_count('txp_file', $where);
        $total = $grand_total - $offset;
        $numPages = $pageby > 0 ? ceil($total / $pageby) : 1;
        $pg = !$pretext['pg'] ? 1 : $pretext['pg'];
        $pgoffset = $offset + ($pg - 1) * $pageby;
        // send paging info to txp:newer and txp:older
        $pageout['pg'] = $pg;
        $pageout['numPages'] = $numPages;
        $pageout['s'] = $s;
        $pageout['c'] = $c;
        $pageout['context'] = 'file';
        $pageout['grand_total'] = $grand_total;
        $pageout['total'] = $total;
        if (empty($thispage)) {
            $thispage = $pageout;
        }
    } else {
        $pgoffset = $offset;
    }
    // preserve order of custom file ids unless 'sort' attribute is set
    if (!empty($atts['id']) && empty($atts['sort'])) {
        $safe_sort = 'field(id, ' . join(',', $ids) . ')';
    } else {
        $safe_sort = doSlash($sort);
    }
    $qparts = array('order by ' . $safe_sort, $limit ? 'limit ' . intval($pgoffset) . ', ' . intval($limit) : '');
    $rs = safe_rows_start('*', 'txp_file', $where . ' ' . join(' ', $qparts));
    if ($rs) {
        $out = array();
        while ($a = nextRow($rs)) {
            $thisfile = file_download_format_info($a);
            $out[] = $thing ? parse($thing) : parse_form($form);
            $thisfile = '';
        }
        if ($out) {
            return doLabel($label, $labeltag) . doWrap($out, $wraptag, $break, $class);
        }
//.........这里部分代码省略.........
开发者ID:bgarrels,项目名称:textpattern,代码行数:101,代码来源:taghandlers.php

示例9: safe_lock

/**
 * Locks a table.
 *
 * The $table argument accepts comma-separated
 * list of table names, if you need to lock
 * multiple tables at once.
 *
 * @param  string $table The table
 * @param  string $type  The lock type
 * @param  bool   $debug Dump the query
 * @return bool   TRUE if the tables are locked
 * @since  4.6.0
 * @example
 * if (safe_lock('myTable'))
 * {
 *     echo "'myTable' is 'write' locked.";
 * }
 */
function safe_lock($table, $type = 'write', $debug = false)
{
    return (bool) safe_query('lock tables ' . join(' ' . $type . ', ', doArray(do_list($table), 'safe_pfx')) . ' ' . $type, $debug);
}
开发者ID:bgarrels,项目名称:textpattern,代码行数:22,代码来源:txplib_db.php

示例10: get_site_langs

 function get_site_langs($set_if_empty = false)
 {
     /*
     Returns an array of the languages the public site supports.
     */
     global $prefs;
     $exists = array_key_exists(L10N_PREFS_LANGUAGES, $prefs);
     if ($set_if_empty and !$exists) {
         $prefs[L10N_PREFS_LANGUAGES] = array(LANG);
         $exists = true;
     }
     if ($exists) {
         $lang_codes = $prefs[L10N_PREFS_LANGUAGES];
         if (!is_array($lang_codes)) {
             $lang_codes = explode(',', $lang_codes);
         }
         $lang_codes = doArray($lang_codes, 'trim');
     } else {
         $lang_codes = NULL;
     }
     return $lang_codes;
 }
开发者ID:netcarver,项目名称:mlp_pack,代码行数:22,代码来源:l10n_bom_file.php

示例11: safe_lock

/**
 * Locks a table.
 *
 * The $table argument accepts comma-separated list of table names, if you need
 * to lock multiple tables at once.
 *
 * @param  string $table The table
 * @param  string $type  The lock type
 * @param  bool   $debug Dump the query
 * @return bool TRUE if the tables are locked
 * @since  4.6.0
 * @example
 * if (safe_lock('myTable'))
 * {
 *     echo "'myTable' is 'write' locked.";
 * }
 */
function safe_lock($table, $type = 'write', $debug = false)
{
    return (bool) safe_query("LOCK TABLES " . join(' ' . $type . ', ', doArray(do_list_unique($table), 'safe_pfx')) . ' ' . $type, $debug);
}
开发者ID:ClaireBrione,项目名称:textpattern,代码行数:21,代码来源:txplib_db.php

示例12: search_for_names

 function search_for_names()
 {
     #
     #	Start our XML output...
     #
     ob_start();
     header("Content-Type: text/xml");
     print '<?xml version=\'1.0\' encoding=\'utf-8\'?>' . n;
     #
     #	Grab the names of every string in the system...
     #
     $admin_langs = MLPLanguageHandler::get_installation_langs();
     $stats = array();
     if ($this->pref('l10n-search_public_strings_only')) {
         $where = '`event` in ("public","common")';
     } else {
         $where = '1=1';
     }
     $full_names = safe_rows_start('name,lang', 'txp_lang', $where . ' ORDER BY name ASC');
     $names = MLPStrings::get_strings($full_names, $stats);
     $num_names = count($names);
     if (!$names || $num_names == 0) {
         exit;
     }
     #
     #	Grab the search term...
     #
     $search_term = gps('l10n-sfn');
     $out = array();
     switch ($search_term) {
         case '':
         case 'undefined':
             #
             #	send a full list of strings...
             #
             foreach ($names as $string => $value) {
                 $out[] = '<li id="' . $string . '" class="l10n_hidden"><a href="' . hu . '" onClick="do_string_edit(\'' . $string . '\'); return false;">' . $string . '</a></li>';
             }
             break;
         case '-':
             #
             #	send those missing a rendition in any language...
             #
             foreach ($names as $string => $value) {
                 $lang_classes = '';
                 $vals = explode(',', $value);
                 $vals = doArray($vals, 'trim');
                 $missing = array_diff($admin_langs, $vals);
                 if (!empty($missing)) {
                     $out[] = '<li id="' . $string . '" class="l10n_hidden"><a href="' . hu . '" onClick="do_string_edit(\'' . $string . '\'); return false;">' . $string . ' [' . join(', ', $missing) . ']</a></li>';
                 }
             }
             break;
         default:
             #
             #	send those missing a rendition in the specified language...
             #
             foreach ($names as $string => $value) {
                 $lang_classes = '';
                 $vals = explode(',', $value);
                 $vals = doArray($vals, 'trim');
                 $missing = array_diff($admin_langs, $vals);
                 if (!empty($missing)) {
                     foreach ($missing as $l) {
                         if ($l === $search_term) {
                             $out[] = '<li id="' . $string . '" class="l10n_hidden"><a href="' . hu . '" onClick="do_string_edit(\'' . $string . '\'); return false;">' . $string . '</a></li>';
                         }
                     }
                 }
             }
             break;
     }
     $subs['{interface}'] = $this->pref('l10n-search_public_strings_only') ? 'public' : '';
     print graf('<span id="l10n_result_count">' . $search_term . '</span>/' . count($out) . ' ' . gTxt('l10n-strings_match', $subs)) . n;
     print '<ul id="l10n_sbn_result_list" class="l10n_visible" >';
     print join('', $out);
     print '</ul>' . n;
     #
     #	Done; send it out...
     #
     exit;
 }
开发者ID:netcarver,项目名称:mlp_pack,代码行数:82,代码来源:l10n_admin_classes.php

示例13: sDoSlash

 function sDoSlash($in)
 {
     global $DB;
     return doArray($in, array($DB, 'escape'));
 }
开发者ID:bgarrels,项目名称:textpattern,代码行数:5,代码来源:controller.php

示例14: smd_ebook_generate


//.........这里部分代码省略.........
            case 'mobi':
                list($report, $retval) = smd_ebook_kindlegen($opf_file, $ebook_folder);
                if ($retval > 1) {
                    $msg = gTxt('smd_ebook_generate_failed', array('{code}' => $retval));
                } else {
                    $msg = gTxt('smd_ebook_generate_ok');
                }
                break;
            case 'zip':
                // All the files are currently in a flat file structure (for ease of browsing/editing).
                // To add them to the zip, they need to be put in a specific file tree.
                $base_dir = get_pref('tempdir') . DS . $ebook_folder . DS;
                $dest_dir = $base_dir . 'zipped' . DS;
                $meta_dir = $dest_dir . 'META-INF';
                $oebps_dir = $dest_dir . 'OEBPS';
                $oebps_img_dir = $oebps_dir . DS . 'images';
                $report[] = 'Files in base folder: ' . $base_dir;
                $zip = new smd_crunch_dZip($outpath . $outfile);
                // Add the static files and folder structure
                $static_files = array('mimetype' => $dest_dir, 'container.xml' => $meta_dir . DS, 'cover.html' => $oebps_dir . DS, '' => $oebps_img_dir . DS);
                foreach ($static_files as $fn => $to) {
                    if (!is_readable($to)) {
                        if (mkdir($to)) {
                            $report[] = 'Created folder: ' . $to;
                        } else {
                            $report[] = 'Failed to create folder: ' . $to;
                        }
                    }
                    $add_to_zip = str_replace($dest_dir, '', $to);
                    if ($add_to_zip !== '') {
                        $zip->addDir($add_to_zip);
                    }
                    if ($fn !== '') {
                        if (copy($base_dir . $fn, $to . $fn)) {
                            $destfile = str_replace($dest_dir, '', $to) . $fn;
                            $zip->addFile($to . $fn, $destfile);
                            $report[] = 'Added file: ' . $destfile;
                        } else {
                            $report[] = 'Failed to add file: ' . $destfile;
                        }
                    }
                }
                // Add each file given in the .smd master file
                $files = file($base_dir . $listfile);
                $files = doArray($files, 'trim');
                foreach ($files as $file) {
                    $info = explode('.', $file);
                    $lastpart = count($info) - 1;
                    $ext = trim($info[$lastpart]);
                    switch ($ext) {
                        case 'html':
                        case 'css':
                        case 'ncx':
                        case 'opf':
                            $destfile = $oebps_dir . DS . $file;
                            if (copy($base_dir . $file, $destfile)) {
                                // Translate fixed (image) paths into relative ones
                                if ($ext === 'html') {
                                    $content = file_get_contents($destfile);
                                    $content = str_replace(get_pref('path_to_site') . DS . $img_dir . DS, 'images' . DS, $content);
                                    $fh = fopen($destfile, 'w');
                                    fwrite($fh, $content);
                                    fclose($fh);
                                }
                                $zip->addFile($oebps_dir . DS . $file, 'OEBPS' . DS . $file);
                                $report[] = 'Added file: OEBPS' . DS . $file;
                            }
                            break;
                        case 'jpg':
                        case 'jpeg':
                        case 'gif':
                        case 'png':
                            if (strpos($file, 'cover') === 0) {
                                $picdir = $oebps_dir;
                            } else {
                                $picdir = $oebps_img_dir;
                            }
                            $destfile = $picdir . DS . $file;
                            $rel_dir = str_replace($dest_dir, '', $picdir);
                            if (!file_exists($destfile) && copy($base_dir . $file, $destfile)) {
                                $report[] = 'Added file: ' . $rel_dir . DS . $file;
                            }
                            // Guard against adding the same image twice
                            if (!in_array($file, $master_img_list)) {
                                $zip->addFile($destfile, $rel_dir . DS . $file);
                                $master_img_list[] = $file;
                            }
                            break;
                    }
                }
                $zip->save();
                $report[] = 'Generated final ePub file: ' . $outpath . $outfile;
                $msg = gTxt('smd_ebook_generate_ok');
                $retval = 0;
                // Success! TODO: trap errors and report failure
                break;
        }
    }
    smd_ebook_ui($msg, $listfile, join(n, $report), $retval, $ebook_folder);
}
开发者ID:Bloke,项目名称:smd_ebook,代码行数:101,代码来源:smd_ebook.php

示例15: zem_event_available_locations

function zem_event_available_locations()
{
    $form = @fetch_form('zem_event_locations');
    // prepare form for use
    $form = str_replace(array("\r\n", "\r"), "\n", $form);
    $list = explode("\n", $form);
    $available_locations = array();
    foreach ($list as $key => $val) {
        $location = explode('=', $val);
        // only add to the list if both a name and title were supplied
        if ($location[0] and $location[1]) {
            list($name, $title) = doArray($location, 'trim');
            $available_locations[$name] = $title;
        }
    }
    return $available_locations;
}
开发者ID:gbp,项目名称:zem_event,代码行数:17,代码来源:zem_event.php


注:本文中的doArray函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。