• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP file函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: onls

 function onls()
 {
     $logdir = UC_ROOT . 'data/logs/';
     $dir = opendir($logdir);
     $logs = $loglist = array();
     while ($entry = readdir($dir)) {
         if (is_file($logdir . $entry) && strpos($entry, '.php') !== FALSE) {
             $logs = array_merge($logs, file($logdir . $entry));
         }
     }
     closedir($dir);
     $logs = array_reverse($logs);
     foreach ($logs as $k => $v) {
         if (count($v = explode("\t", $v)) > 1) {
             $v[3] = $this->date($v[3]);
             $v[4] = $this->lang[$v[4]];
             $loglist[$k] = $v;
         }
     }
     $page = max(1, intval($_GET['page']));
     $start = ($page - 1) * UC_PPP;
     $num = count($loglist);
     $multipage = $this->page($num, UC_PPP, $page, 'admin.php?m=log&a=ls');
     $loglist = array_slice($loglist, $start, UC_PPP);
     $this->view->assign('loglist', $loglist);
     $this->view->assign('multipage', $multipage);
     $this->view->display('admin_log');
 }
开发者ID:tang86,项目名称:discuz-utf8,代码行数:28,代码来源:log.php


示例2: ajoutLieu

function ajoutLieu()
{
    require 'connect.php';
    $requete = $bdd->query("SELECT \n\t\t\t\t\t\t\t\tVILID\n\t\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t\tcommune");
    $villes = $requete->fetchAll();
    $requete->closeCursor();
    $requete = $bdd->prepare("SELECT \n\t\t\t\t\t\t\t\tLIEUID\n\t\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t\tLIEU\n\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\tLIEUID=:lieuId\n\t\t\t\t\t\t\t\tAND\n\t\t\t\t\t\t\t\tVILID=:ville\n\t\t\t\t\t\t\t\tAND\n\t\t\t\t\t\t\t\tLIEUNOM=:nom");
    $requeteSeconde = $bdd->prepare("INSERT INTO LIEU\n\t\t\t\t\t\t\t\t\t\t(LIEUID,\n\t\t\t\t\t\t\t\t\t\tVILID,\n\t\t\t\t\t\t\t\t\t\tLIEUNOM,\n\t\t\t\t\t\t\t\t\t\tLIEUCOORDGPS)\n\t\t\t\t\t\t\t\t\tVALUES\n\t\t\t\t\t\t\t\t\t\t(:lieuId,\n\t\t\t\t\t\t\t\t\t\t:ville,\n\t\t\t\t\t\t\t\t\t\t:nom,\n\t\t\t\t\t\t\t\t\t\t:gps)");
    for ($i = 0; $i < 100; $i++) {
        echo $lieuId = $i;
        echo $ville = $villes[rand(0, sizeof($villes) - 1)]['VILID'];
        $lieuT = file('./generateurLieu.txt');
        $lieu = array(trim($lieuT[rand(0, 93)]), trim($lieuT[rand(0, 93)]));
        $lieu = implode("-", $lieu);
        echo $nom = $lieu;
        echo $gps = rand(0, 5000);
        echo "<br />";
        $requete->execute(array("ville" => $ville, "nom" => $nom));
        if ($requete->fetch() == false) {
            $requeteSeconde->execute(array("lieuId" => $lieuId, "ville" => $ville, "nom" => $nom, "gps" => $gps));
        } else {
            $i--;
        }
    }
    $requete->closeCursor();
    $requeteSeconde->closeCursor();
}
开发者ID:ploufppe,项目名称:ppe,代码行数:27,代码来源:generateurLieuAB.php


示例3: get_lvm_iscsi_deployment_image_rootdevice_identifier

function get_lvm_iscsi_deployment_image_rootdevice_identifier($lvm_iscsi_storage_id)
{
    global $OPENQRM_SERVER_BASE_DIR;
    global $OPENQRM_ADMIN;
    global $event;
    // place for the storage stat files
    $StorageDir = $_SERVER["DOCUMENT_ROOT"] . '/openqrm/base/plugins/lvm-storage/storage';
    $rootdevice_identifier_array = array();
    $storage = new storage();
    $storage->get_instance_by_id($lvm_iscsi_storage_id);
    $storage_resource = new resource();
    $storage_resource->get_instance_by_id($storage->resource_id);
    $storage_resource_id = $storage_resource->id;
    $ident_file = "{$StorageDir}/{$storage_resource_id}.lv.lvm-iscsi-deployment.ident";
    if (file_exists($ident_file)) {
        unlink($ident_file);
    }
    // send command
    $resource_command = "{$OPENQRM_SERVER_BASE_DIR}/openqrm/plugins/lvm-storage/bin/openqrm-lvm-storage post_identifier -t lvm-iscsi-deployment -u {$OPENQRM_ADMIN->name} -p {$OPENQRM_ADMIN->password}";
    $storage_resource->send_command($storage_resource->ip, $resource_command);
    if (!lvm_iscsi_deployment_wait_for_identfile($ident_file)) {
        $event->log("get_image_rootdevice_identifier", $_SERVER['REQUEST_TIME'], 2, "image.lvm-iscsi-deployment", "Timeout while requesting image identifier from storage id {$storage->id}", "", "", 0, 0, 0);
        return;
    }
    $fcontent = file($ident_file);
    foreach ($fcontent as $lun_info) {
        $tpos = strpos($lun_info, ",");
        $timage_name = trim(substr($lun_info, 0, $tpos));
        $troot_device = trim(substr($lun_info, $tpos + 1));
        $rootdevice_identifier_array[] = array("value" => "{$troot_device}", "label" => "{$timage_name}");
    }
    return $rootdevice_identifier_array;
}
开发者ID:kelubo,项目名称:OpenQRM,代码行数:33,代码来源:image.lvm-iscsi-deployment.php


示例4: installLanguage2

 function installLanguage2($f, $l, $m)
 {
     global $php;
     $patt = '/^([A-Z0-9_]+)[\\s]{0,}=[\\s]{0,}[\'"](.*)[\'"];$/';
     foreach (file($f) as $item) {
         $item = trim($item);
         if ($item != '') {
             if (preg_match($patt, $item, $match)) {
                 if (isset($php[$match[1]])) {
                     $php[$match[1]][$l] = addslashes($match[2]);
                 } else {
                     $save = array();
                     if (preg_match('/^[0-9]+$/', $value)) {
                         $save['type'] = 'int';
                     } else {
                         $save['type'] = 'text';
                     }
                     $save['key'] = $match[1];
                     $save['owner'] = $m;
                     $save[$l] = addslashes($match[2]);
                     $save['js'] = 1;
                     $php[$match[1]] = $save;
                 }
             }
         }
     }
 }
开发者ID:phannack,项目名称:GCMS,代码行数:27,代码来源:langtool.php


示例5: sendMessage

function sendMessage($phoneTo, $textMessage)
{
    $user = "noreplypw606";
    $password = "pw10606jo";
    $api_id = "3356658";
    $baseurl = "http://api.clickatell.com";
    $text = urlencode($textMessage);
    $to = $phoneTo;
    // auth call
    $url = "{$baseurl}/http/auth?user={$user}&password={$password}&api_id={$api_id}";
    // do auth call
    $ret = file($url);
    // explode our response. return string is on first line of the data returned
    $sess = explode(":", $ret[0]);
    if ($sess[0] == "OK") {
        $sess_id = trim($sess[1]);
        // remove any whitespace
        $url = "{$baseurl}/http/sendmsg?session_id={$sess_id}&to={$to}&text={$text}";
        // do sendmsg call
        $ret = file($url);
        $send = explode(":", $ret[0]);
        if ($send[0] == "ID") {
            // echo "success\nmessage ID: ". $send[1];
            return true;
        } else {
            // echo "send message failed";
            return false;
        }
    } else {
        // echo "Authentication failure: ". $ret[0];
        return false;
    }
}
开发者ID:ricain59,项目名称:fortaff,代码行数:33,代码来源:mobile.php


示例6: __construct

 function __construct($file, $firstLine = true)
 {
     $this->file = $file;
     $this->db = array();
     $this->dbBackup = array();
     $this->firstLine = $firstLine;
     if (file_exists($file)) {
         // Read JSON file.
         $lines = file($file);
         // Remove the first line, the first line is for security reasons.
         if ($firstLine) {
             unset($lines[0]);
         }
         // Regenerate the JSON file.
         $implode = implode($lines);
         // Unserialize, JSON to Array.
         $array = $this->unserialize($implode);
         if (empty($array)) {
             Log::set(__METHOD__ . LOG_SEP . 'Invalid JSON file: ' . $file . ', cannot be decoded. Check the file content.');
         } else {
             $this->db = $array;
             $this->dbBackup = $array;
         }
     } else {
         Log::set(__METHOD__ . LOG_SEP . 'File ' . $file . ' does not exists');
     }
 }
开发者ID:clstrfcuk,项目名称:bludit,代码行数:27,代码来源:dbjson.class.php


示例7: tplsadmin_copy_templates_f2db

function tplsadmin_copy_templates_f2db($tplset_to, $whr_append = '1')
{
    global $db;
    // get tplsource
    $result = $db->query("SELECT * FROM " . $db->prefix("tplfile") . "  WHERE tpl_tplset='default' AND ({$whr_append})");
    while ($row = $db->fetchArray($result)) {
        $basefilepath = tplsadmin_get_basefilepath($row['tpl_module'], $row['tpl_type'], $row['tpl_file']);
        $tpl_source = rtrim(implode("", file($basefilepath)));
        $lastmodified = filemtime($basefilepath);
        $drs = $db->query("SELECT tpl_id FROM " . $db->prefix("tplfile") . " WHERE tpl_tplset='" . addslashes($tplset_to) . "' AND ({$whr_append}) AND tpl_file='" . addslashes($row['tpl_file']) . "' AND tpl_refid='" . addslashes($row['tpl_refid']) . "'");
        if (!$db->getRowsNum($drs)) {
            // INSERT mode
            $sql = "INSERT INTO " . $db->prefix("tplfile") . " SET tpl_refid='" . addslashes($row['tpl_refid']) . "',tpl_desc='" . addslashes($row['tpl_desc']) . "',tpl_lastmodified='" . addslashes($lastmodified) . "',tpl_type='" . addslashes($row['tpl_type']) . "',tpl_tplset='" . addslashes($tplset_to) . "',tpl_file='" . addslashes($row['tpl_file']) . "',tpl_module='" . addslashes($row['tpl_module']) . "'";
            $db->query($sql);
            $tpl_id = $db->getInsertId();
            $db->query("INSERT INTO " . $db->prefix("tplsource") . " SET tpl_id='{$tpl_id}', tpl_source='" . addslashes($tpl_source) . "'");
            altsys_template_touch($tpl_id);
        } else {
            while (list($tpl_id) = $db->fetchRow($drs)) {
                // UPDATE mode
                $db->query("UPDATE " . $db->prefix("tplfile") . " SET tpl_lastmodified='" . addslashes($lastmodified) . "' WHERE tpl_id='{$tpl_id}'");
                $db->query("UPDATE " . $db->prefix("tplsource") . " SET tpl_source='" . addslashes($tpl_source) . "' WHERE tpl_id='{$tpl_id}'");
                altsys_template_touch($tpl_id);
            }
        }
    }
}
开发者ID:BackupTheBerlios,项目名称:peakxoops-svn,代码行数:27,代码来源:tpls_functions.php


示例8: generate

 public function generate($fname, $gender)
 {
     $this->maintemplate = file_get_contents('Template/NCLNameCaseRuTest.main');
     $this->testtemplate = file_get_contents('Template/NCLNameCaseRuTest' . $fname . $gender . '.test');
     $this->resultArr = file('Names/' . $gender . '_full_result.txt');
     $this->count = 0;
     if ($gender == 'boy') {
         $this->gender = 1;
     } else {
         $this->gender = 2;
     }
     //foreach ($this->resultArr as $key=>$value)
     //{
     //$this->gender=$key+1;
     foreach ($this->resultArr as $id => $name) {
         $tmpnames = explode("#", trim(str_replace('ё', 'е', $name)));
         $firstRes = array();
         $secondRes = array();
         $fatherRes = array();
         $c = count($tmpnames);
         for ($i = 0; $i < $c; $i++) {
             $cur = explode(" ", trim($tmpnames[$i]));
             $firstRes[] = trim($cur[1]);
             $secondRes[] = trim($cur[0]);
             $fatherRes[] = trim($cur[2]);
         }
         $this->generateTest($firstRes, $secondRes, $fatherRes);
     }
     //}
     $res = str_replace('{% tests %}', $this->tests, $this->maintemplate);
     $res = str_replace('{% name %}', $fname, $res);
     file_put_contents('../Library/NCLNameCaseRuTest' . $fname . $gender . '.php', $res);
 }
开发者ID:klearvue,项目名称:namecaselib,代码行数:33,代码来源:NCLNameCaseRuTest.generator.php


示例9: loadfont

 function loadfont($fontfile)
 {
     $this->fontFile = file($fontfile);
     if (!$this->fontFile) {
         die("Couldnt open fontfile {$fontfile}\n");
     }
     $hp = explode(" ", $this->fontFile[0]);
     // get header
     $this->signature = substr($hp[0], 0, strlen($hp[0]) - 1);
     $this->hardblank = substr($hp[0], strlen($hp[0]) - 1, 1);
     $this->height = $hp[1];
     $this->baseline = $hp[2];
     $this->maxLenght = $hp[3];
     $this->oldLayout = $hp[4];
     $this->commentLines = $hp[5] + 1;
     if (isset($hp[6])) {
         $this->printDirection = $hp[6];
     }
     if (isset($hp[7])) {
         $this->fullLayout = $hp[7];
     }
     if (isset($hp[8])) {
         $this->codeTagCount = $hp[8];
     }
     unset($hp);
     return true;
     if ($this->signature != "flf2a") {
         trigger_error("Unknown font version " . $this->signature . "\n");
         return false;
     } else {
         return true;
     }
 }
开发者ID:diszo2009,项目名称:multi-captcha,代码行数:33,代码来源:php_figlet.php


示例10: getControllerCode

 protected function getControllerCode()
 {
     $r = new \ReflectionClass($this->controller[0]);
     $m = $r->getMethod($this->controller[1]);
     $code = file($r->getFilename());
     return '    ' . $m->getDocComment() . "\n" . implode('', array_slice($code, $m->getStartline() - 1, $m->getEndLine() - $m->getStartline() + 1));
 }
开发者ID:data250,项目名称:FOSUserBundle,代码行数:7,代码来源:DemoExtension.php


示例11: doProcess

 /**
  * @see LiveTest\Config\Tags\TestSuite.Base::doProcess()
  */
 protected function doProcess(\LiveTest\Config\TestSuite $config, $parameters)
 {
     $config->getCurrentSession()->doNotInherit();
     foreach ($parameters as $file) {
         $config->getCurrentSession()->includePageRequests(Request::createRequestsFromParameters(file($config->getBaseDir() . '/' . $file), $config->getDefaultDomain()));
     }
 }
开发者ID:nicolas-lang,项目名称:LiveTest2,代码行数:10,代码来源:PageFiles.php


示例12: importDatabaseFile

 function importDatabaseFile($filename, $block = true)
 {
     # temporary variable, used to store current query
     $tmpline = '';
     # read in entire file
     $lines = file($filename);
     # loop through each line
     foreach ($lines as $line) {
         # skip it if it's a comment
         if (substr($line, 0, 2) == '--' || $line == '') {
             continue;
         }
         # add this line to the current segment
         $tmpline .= $line;
         # if it has a semicolon at the end, it's the end of the query
         if (substr(trim($line), -1, 1) == ';') {
             if (!empty($tmpline)) {
                 $errMsg = $this->query($tmpline);
                 if ($block && $this->error) {
                     return $errMsg;
                 }
             }
             $tmpline = '';
         }
     }
 }
开发者ID:codegooglecom,项目名称:seopanel,代码行数:26,代码来源:db.class.php


示例13: checkUpdateFile

function checkUpdateFile($filename_update)
{
    global $server_offline;
    global $update_failed;
    global $downloadfacut;
    if (!file_exists($filename_update)) {
        $server_offline = true;
        global $cccam_host;
        global $webinfo_port;
        $update_failed = "<FONT COLOR=red><B>Update failed : </B></FONT>Unable to connect to {$cccam_host}:{$webinfo_port}";
    } else {
        $filename_update_data = file($filename_update);
        if (count($filename_update_data) < 1) {
            $server_offline = true;
            $update_failed = "<FONT COLOR=red><B>Update failed : </B></FONT>no data";
        } else {
            $linie = $filename_update_data[0];
            if (!strstr($linie, "200 OK")) {
                $server_offline = true;
                $update_failed = "<FONT COLOR=red><B>Update failed : </B></FONT>" . $linie;
            }
        }
    }
    if ($server_offline == false) {
        $downloadfacut = true;
        stripdata($filename_update);
    } else {
        if (file_exists($filename_update)) {
            unlink($filename_update);
        }
    }
}
开发者ID:grinco,项目名称:cccaminfo,代码行数:32,代码来源:update.php


示例14: _getUserLocation

 /**
  * _getUserLocation
  *
  * das aktuelle Herkunftsland des angemeldeten Benutzers wird ermittelt
  *
  * @static
  * @access private
  * @param  string  $ip
  * @return string  $return
  */
 private static function _getUserLocation($ip)
 {
     $return = 'eu';
     // Datei einlesen
     $countrydb = file(dirname(__FILE__) . '/../ip-to-country.csv');
     // IP umformen
     $ip_number = sprintf('%u', ip2long($ip));
     // Binärsuche starten
     $low = 0;
     $high = count($countrydb) - 1;
     $count = 0;
     while ($low <= $high) {
         $count++;
         $mid = floor(($low + $high) / 2);
         $num1 = substr($countrydb[$mid], 1, 10);
         $num2 = substr($countrydb[$mid], 14, 10);
         if ($num1 <= $ip_number && $ip_number <= $num2) {
             // Länderkennung ermitteln
             $return = substr($countrydb[$mid], 27, 2);
             // Schleife beenden, sobald das Land ermittelt wurde
             break;
         } else {
             if ($ip_number < $num1) {
                 $high = $mid - 1;
             } else {
                 $low = $mid + 1;
             }
         }
     }
     // die Länderkennung wird 2-stellig zurückgegeben
     return strtolower($return);
 }
开发者ID:angstmann82,项目名称:flybook_2.0,代码行数:42,代码来源:User.class.php


示例15: __construct

 /**
  *
  * @param String $file
  * @throws \Exception
  */
 public function __construct($file)
 {
     $this->_position = 0;
     if (is_array($file) && strlen(rtrim($file[0], chr(10) . chr(13) . "\n" . "\r")) == 400) {
         $this->file = $file;
     } else {
         if (is_file($file) && file_exists($file)) {
             $this->file = file($file);
         } else {
             if (is_string($file)) {
                 $this->file = preg_split('/\\r\\n|\\r|\\n/', $file);
                 if (empty(last($this->file))) {
                     array_pop($this->file);
                 }
             } else {
                 throw new \Exception("Arquivo: não existe");
             }
         }
     }
     $this->isRetorno = substr($this->file[0], 0, 9) == '02RETORNO' ? true : false;
     if (!in_array(substr($this->file[0], 76, 3), array_keys($this->bancos))) {
         throw new \Exception(sprintf("Banco: %s, inválido", substr($this->file[0], 76, 3)));
     }
     $this->header = new Header();
     $this->trailer = new Trailer();
 }
开发者ID:jhonleandres,项目名称:laravel-boleto,代码行数:31,代码来源:AbstractCnab.php


示例16: init_display_template

/**
* Writing Data into plain Template Vars
*/
function init_display_template($template_var, $replacement, $filename = 'viewtopic_attach_body.tpl')
{
    global $template;
    // This function is adapted from the old template class
    // I wish i had the functions from the 3.x one. :D (This class rocks, can't await to use it in Mods)
    // Handle Attachment Informations
    if (!isset($template->uncompiled_code[$template_var]) && empty($template->uncompiled_code[$template_var])) {
        // If we don't have a file assigned to this handle, die.
        if (!isset($template->files[$template_var])) {
            die("Template->loadfile(): No file specified for handle {$template_var}");
        }
        $filename_2 = $template->files[$template_var];
        $str = implode('', @file($filename_2));
        if (empty($str)) {
            die("Template->loadfile(): File {$filename_2} for handle {$template_var} is empty");
        }
        $template->uncompiled_code[$template_var] = $str;
    }
    $complete_filename = $filename;
    if (substr($complete_filename, 0, 1) != '/') {
        $complete_filename = $template->root . '/' . $complete_filename;
    }
    if (!file_exists($complete_filename)) {
        die("Template->make_filename(): Error - file {$complete_filename} does not exist");
    }
    $content = implode('', file($complete_filename));
    if (empty($content)) {
        die('Template->loadfile(): File ' . $complete_filename . ' is empty');
    }
    // replace $replacement with uncompiled code in $filename
    $template->uncompiled_code[$template_var] = str_replace($replacement, $content, $template->uncompiled_code[$template_var]);
    // Force Reload on cached version
    display_compile_cache_clear($template->files[$template_var], $template_var);
}
开发者ID:nmpetkov,项目名称:ZphpBB2,代码行数:37,代码来源:displaying.php


示例17: Get

 function Get($rss_url)
 {
     // If CACHE ENABLED
     if ($this->cache_dir != '') {
         $cache_file = $this->cache_dir . '/rsscache_' . md5($rss_url);
         $timedif = @(time() - filemtime($cache_file));
         if ($timedif < $this->cache_time) {
             // cached file is fresh enough, return cached array
             $result = unserialize(join('', file($cache_file)));
             // set 'cached' to 1 only if cached file is correct
             if ($result) {
                 $result['cached'] = 1;
             }
         } else {
             // cached file is too old, create new
             $result = $this->Parse($rss_url);
             $serialized = serialize($result);
             if ($f = @fopen($cache_file, 'w')) {
                 fwrite($f, $serialized, strlen($serialized));
                 fclose($f);
             }
             if ($result) {
                 $result['cached'] = 0;
             }
         }
     } else {
         $result = $this->Parse($rss_url);
         if ($result) {
             $result['cached'] = 0;
         }
     }
     // return result
     return $result;
 }
开发者ID:laiello,项目名称:xiyoulinux,代码行数:34,代码来源:lastRSS.php


示例18: getCallableCode

function getCallableCode()
{
    $scriptName = $_SERVER['SCRIPT_FILENAME'];
    $fileLines = file($scriptName);
    for ($i = 0; $i < sizeof($fileLines); ++$i) {
        $line = trim($fileLines[$i]);
        if (substr($line, 0, 9) == "FUNCTION " || substr($line, 0, 9) == "function ") {
            $match[] = $line;
        }
    }
    for ($i = 0; $i < sizeof($match); ++$i) {
        $line = str_replace("function ", "", $match[$i]);
        $line = str_replace("FUNCTION ", "", $line);
        $line = str_replace("{", "", $line);
        $parts = explode("(", $line);
        $func_name = trim($parts[0]);
        $Tempargs = explode(")", $parts[1]);
        $args = explode(",", $Tempargs[0]);
        $argSize = sizeof($args);
        // check args for preset values
        if ($argSize > 0) {
            foreach ($args as $arg) {
                $arg = trim($arg);
                $varArray = explode("=", $arg);
                $var_name = trim(str_replace("\$", "", $varArray["0"]));
                $var_value = trim($varArray["1"]);
                $resultArray[$func_name][$var_name] = $var_value;
            }
        }
    }
    return $resultArray;
}
开发者ID:cjvaz,项目名称:expressomail,代码行数:32,代码来源:cpaint2.backend-debugger.php


示例19: get_post_templates

 /**
  * Scans the template files of the active theme, and returns an
  * array of [Template Name => {file}.php]
  *
  * @since 0.2.0
  *
  * @return array
  */
 function get_post_templates()
 {
     $themes = get_themes();
     $theme = get_current_theme();
     $templates = $themes[$theme]['Template Files'];
     $post_templates = array();
     $base = array(trailingslashit(get_template_directory()), trailingslashit(get_stylesheet_directory()));
     foreach ((array) $templates as $template) {
         $template = WP_CONTENT_DIR . str_replace(WP_CONTENT_DIR, '', $template);
         $basename = str_replace($base, '', $template);
         /** Don't allow template files in subdirectories */
         if (false !== strpos($basename, '/')) {
             continue;
         }
         $template_data = implode('', file($template));
         $name = '';
         if (preg_match('|Single Post Template:(.*)$|mi', $template_data, $name)) {
             $name = _cleanup_header_comment($name[1]);
         }
         if (!empty($name)) {
             if (basename($template) != basename(__FILE__)) {
                 $post_templates[trim($name)] = $basename;
             }
         }
     }
     return $post_templates;
 }
开发者ID:adisonc,项目名称:MaineLearning,代码行数:35,代码来源:post-templates.php


示例20: actionIndex

 public function actionIndex()
 {
     require_once 'Zend/Mail.php';
     $sql = "SELECT * FROM client where (cli_saleemail = 'yes' or cli_letemail  = 'yes') and cli_email != '' and cli_email is not null";
     $data = Yii::app()->db->createCommand($sql)->queryAll();
     $exclude = [];
     if (file_exists('luna/exclude')) {
         $exclude = file('luna/exclude');
     }
     foreach ($data as $client) {
         if (in_array($client['cli_email'], $exclude)) {
             $this->log('excluded ' . $client['cli_email']);
             continue;
         }
         try {
             $mail = new Zend_Mail("UTF-8");
             $mail->addTo($client['cli_email']);
             $mail->setFrom('[email protected]');
             $mail->setSubject('Win 2 tickets to the Luna Outdoor Cinema');
             $mail->setBodyHtml($this->renderFile(Yii::getPathOfAlias('application.commands.luna') . '/template.php', compact('client'), true));
             $this->log('Sending mail to ' . $client['cli_fname'] . ' [' . $client['cli_email'] . ']');
             $mail->send();
             $this->log('Mail sent to ' . $client['cli_fname'] . ' [' . $client['cli_email'] . ']');
         } catch (Exception $e) {
             $this->log('ERROR : Mail NOT sent to ' . $client['cli_fname'] . ' [' . $client['cli_email'] . ']');
         }
     }
 }
开发者ID:jankichaudhari,项目名称:yii-site,代码行数:28,代码来源:LunaCinemaCommand.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP fileExists函数代码示例发布时间:2022-05-15
下一篇:
PHP fieldset函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap