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

PHP io_mkdir_p函数代码示例

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

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



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

示例1: initRepo

 private function initRepo()
 {
     //get path to the repo root (by default DokuWiki's savedir)
     if (defined('DOKU_FARM')) {
         $repoPath = $this->getConf('repoPath');
     } else {
         $repoPath = DOKU_INC . $this->getConf('repoPath');
     }
     //set the path to the git binary
     $gitPath = trim($this->getConf('gitPath'));
     if ($gitPath !== '') {
         Git::set_bin($gitPath);
     }
     //init the repo and create a new one if it is not present
     io_mkdir_p($repoPath);
     $repo = new GitRepo($repoPath, true, true);
     //set git working directory (by default DokuWiki's savedir)
     $repoWorkDir = DOKU_INC . $this->getConf('repoWorkDir');
     Git::set_bin(Git::get_bin() . ' --work-tree ' . escapeshellarg($repoWorkDir));
     $params = str_replace(array('%mail%', '%user%'), array($this->getAuthorMail(), $this->getAuthor()), $this->getConf('addParams'));
     if ($params) {
         Git::set_bin(Git::get_bin() . ' ' . $params);
     }
     return $repo;
 }
开发者ID:MarcinKlejna,项目名称:dokuwiki-plugin-gitbacked,代码行数:25,代码来源:editcommit.php


示例2: ajax_prepare

/**
 * Prepare the static dump
 */
function ajax_prepare()
{
    global $conf;
    $today = date('Y-m-d');
    $staticDir = DOKU_INC . $conf['savedir'] . '/static/' . $today . "/";
    // create output directory
    io_mkdir_p($rootStaticPath);
    // acquire a lock
    $lock = $conf['lockdir'] . '/_dokukiwix.lock';
    if (!file_exists($lock) || time() - @filemtime($lock) > 60 * 5) {
        unlink($lock);
        if ($fp = fopen($lock, 'w+')) {
            fwrite($fp, $today);
            fclose($fp);
        }
    } else {
        print 'dokukiwix is locked.';
        exit;
    }
    // create mandatory directories
    io_mkdir_p($staticDir . '/images/');
    io_mkdir_p($staticDir . '/images/extern/');
    io_mkdir_p($staticDir . '/pages/');
    io_mkdir_p($staticDir . '/css/');
    print 'true';
}
开发者ID:kiwix,项目名称:dokukiwix,代码行数:29,代码来源:ajax.php


示例3: __construct

 function __construct($pagesize = 'A4', $orientation = 'portrait')
 {
     global $conf;
     io_mkdir_p(_MPDF_TTFONTDATAPATH);
     io_mkdir_p(_MPDF_TEMP_PATH);
     $format = $pagesize;
     if ($orientation == 'landscape') {
         $format .= '-L';
     }
     switch ($conf['lang']) {
         case 'zh':
         case 'zh-tw':
         case 'ja':
         case 'ko':
             $mode = '+aCJK';
             break;
         default:
             $mode = 'UTF-8-s';
     }
     // we're always UTF-8
     parent::__construct($mode, $format);
     $this->autoScriptToLang = true;
     $this->baseScript = 1;
     $this->autoVietnamese = true;
     $this->autoArabic = true;
     $this->autoLangToFont = true;
     $this->ignore_invalid_utf8 = true;
     $this->tabSpaces = 4;
 }
开发者ID:a-gundy,项目名称:dokuwiki-plugin-dw2pdf,代码行数:29,代码来源:DokuPDF.class.php


示例4: __construct

 function __construct()
 {
     io_mkdir_p(_MPDF_TTFONTDATAPATH);
     io_mkdir_p(_MPDF_TEMP_PATH);
     // we're always UTF-8
     parent::__construct('UTF-8-s');
     $this->SetAutoFont(AUTOFONT_ALL);
     $this->ignore_invalid_utf8 = true;
 }
开发者ID:neutrinog,项目名称:Door43,代码行数:9,代码来源:DokuPDF.class.php


示例5: send_theme

 /**
  * Send a zipped theme
  *
  * @author Samuele Tognini <[email protected]>
  */
 function send_theme($file)
 {
     require_once DOKU_PLUGIN . 'indexmenu/syntax/indexmenu.php';
     $idxm = new syntax_plugin_indexmenu_indexmenu();
     //clean the file name
     $file = cleanID($file);
     //check config
     if (!$idxm->getConf('be_repo') || empty($file)) {
         return false;
     }
     $repodir = INDEXMENU_IMG_ABSDIR . "/repository";
     $zipfile = $repodir . "/{$file}.zip";
     $localtheme = INDEXMENU_IMG_ABSDIR . "/{$file}/";
     //theme does not exists
     if (!file_exists($localtheme)) {
         return false;
     }
     if (!io_mkdir_p($repodir)) {
         return false;
     }
     $lm = @filemtime($zipfile);
     //no cached zip or older than 1 day
     if ($lm < time() - 60 * 60 * 24) {
         //create the zip
         require_once DOKU_PLUGIN . "indexmenu/inc/pclzip.lib.php";
         @unlink($zipfile);
         $zip = new PclZip($zipfile);
         $status = $zip->add($localtheme, PCLZIP_OPT_REMOVE_ALL_PATH);
         //error
         if ($status == 0) {
             return false;
         }
     }
     $len = (int) filesize($zipfile);
     //don't send large zips
     if ($len > 2 * 1024 * 1024) {
         return false;
     }
     //headers
     header('Cache-Control: must-revalidate, no-transform, post-check=0, pre-check=0');
     header('Pragma: public');
     header('Content-Type: application/zip');
     header('Content-Disposition: attachment; filename="' . basename($zipfile) . '";');
     header("Content-Transfer-Encoding: binary");
     //send zip
     $fp = @fopen($zipfile, 'rb');
     if ($fp) {
         $ct = @fread($fp, $len);
         print $ct;
     }
     @fclose($fp);
     return true;
 }
开发者ID:lorea,项目名称:Hydra-dev,代码行数:58,代码来源:repo.class.php


示例6: initRepo

 private function initRepo()
 {
     //get path to the repo root (by default DokuWiki's savedir)
     $repoPath = DOKU_INC . $this->getConf('repoPath');
     //init the repo and create a new one if it is not present
     io_mkdir_p($repoPath);
     $repo = new GitRepo($repoPath, true, true);
     //set git working directory (by default DokuWiki's savedir)
     $repoWorkDir = DOKU_INC . $this->getConf('repoWorkDir');
     $repo->git_path .= ' --work-tree ' . escapeshellarg($repoWorkDir);
     $params = str_replace(array('%mail%', '%user%'), array($this->getAuthorMail(), $this->getAuthor()), $this->getConf('addParams'));
     if ($params) {
         $repo->git_path .= ' ' . $params;
     }
     return $repo;
 }
开发者ID:daimrod,项目名称:dokuwiki-plugin-gitbacked,代码行数:16,代码来源:editcommit.php


示例7: handle

 /**
  * 
  *
  * @param Doku_Event $event  Not used
  * @param mixed      $param  Not used
  * @return void
  */
 public function handle(Doku_Event &$event, $param)
 {
     global $conf;
     if ($event->data != 'feedaggregator') {
         return;
     }
     $event->preventDefault();
     // See if we need a token and whether it matches.
     $requiredToken = $this->getConf('token');
     $suppliedToken = isset($_GET['token']) ? $_GET['token'] : false;
     if (!empty($requiredToken) && $suppliedToken !== $requiredToken) {
         msg("Token doesn't match for feedaggregator");
         return true;
     }
     // Get the feed list.
     $feeds = file(fullpath($conf['tmpdir'] . '/feedaggregator.csv'));
     // Set up SimplePie and merge all the feeds together.
     $simplepie = new FeedParser();
     $ua = 'Mozilla/4.0 (compatible; DokuWiki feedaggregator plugin ' . wl('', '', true) . ')';
     $simplepie->set_useragent($ua);
     $simplepie->force_feed($this->getConf('force_feed'));
     $simplepie->force_fsockopen($this->getConf('force_fsockopen'));
     $simplepie->set_feed_url($feeds);
     // Set up caching.
     $cacheDir = fullpath($conf['cachedir'] . '/feedaggregator');
     io_mkdir_p($cacheDir);
     $simplepie->enable_cache();
     $simplepie->set_cache_location($cacheDir);
     // Run the actual feed aggregation.
     $simplepie->init();
     // Check for errors.
     if ($simplepie->error()) {
         header("Content-type:text/plain");
         echo join("\n", $simplepie->error());
     }
     // Create the output HTML and cache it for use by the syntax component.
     $html = '';
     foreach ($simplepie->get_items() as $item) {
         $html .= "<div class='feedaggregator_item'>\n" . "<h2>" . $item->get_title() . "</h2>\n" . $item->get_content() . "\n" . "<p>" . "  <a href='" . $item->get_permalink() . "'>Published " . $item->get_date('j M Y') . "</a> " . "  in <a href='" . $item->get_feed()->get_permalink() . "'>" . $item->get_feed()->get_title() . "</a>" . "</p>\n" . "</div>\n\n";
     }
     io_saveFile($cacheDir . '/output.html', $html);
     // Output nothing, as this should be run from cron and we don't want to
     // flood the logs with success.
     exit(0);
 }
开发者ID:samwilson,项目名称:dokuwiki-plugin-feedaggregator,代码行数:52,代码来源:action.php


示例8: move_files

    /**
     * Internal function for moving and renaming meta/attic files between namespaces
     *
     * @param string $dir   The root path of the files (e.g. $conf['metadir'] or $conf['olddir']
     * @param array  $opts  Move options (used here: ns, newns, name, newname)
     * @param string $extregex Regular expression for matching the extension of the file that shall be moved
     * @return bool If the files were moved successfully
     */
    private function move_files($dir, $opts, $extregex) {
        $old_path = $dir;
        if ($opts['ns'] != '') $old_path .= '/'.utf8_encodeFN(str_replace(':', '/', $opts['ns']));
        $new_path = $dir;
        if ($opts['newns'] != '') $new_path .= '/'.utf8_encodeFN(str_replace(':', '/', $opts['newns']));
        $regex = '/^'.preg_quote(utf8_encodeFN($opts['name'])).'('.$extregex.')$/u';

        if (!is_dir($old_path)) return true; // no media files found

        $dh = @opendir($old_path);
        if($dh) {
            while(($file = readdir($dh)) !== false) {
                if (substr($file, 0, 1) == '.') continue;
                $match = array();
                if (is_file($old_path.'/'.$file) && preg_match($regex, $file, $match)) {
                    if (!is_dir($new_path)) {
                        if (!io_mkdir_p($new_path)) {
                            msg('Creating directory '.hsc($new_path).' failed.', -1);
                            return false;
                        }
                    }
                    if (!io_rename($old_path.'/'.$file, $new_path.'/'.utf8_encodeFN($opts['newname'].$match[1]))) {
                        msg('Moving '.hsc($old_path.'/'.$file).' to '.hsc($new_path.'/'.utf8_encodeFN($opts['newname'].$match[1])).' failed.', -1);
                        return false;
                    }
                }
            }
            closedir($dh);
        } else {
            msg('Directory '.hsc($old_path).' couldn\'t be opened.', -1);
            return false;
        }
        return true;
    }
开发者ID:neutrinog,项目名称:Door43,代码行数:42,代码来源:helper.php


示例9: handle_action_act_preprocess

 public function handle_action_act_preprocess(Doku_Event &$event, $param)
 {
     global $ID;
     global $TEXT;
     global $ACT;
     global $SUM;
     global $RANGE;
     global $REV;
     $act = $event->data;
     if ($act != 'dokutranslate_review') {
         $act = act_clean($act);
         $act = act_permcheck($act);
     }
     # Ignore drafts if the page is being translated
     # FIXME: Find a way to save $_REQUEST['parid'] into the draft
     if (@file_exists(metaFN($ID, '.translate')) && in_array($act, array('draft', 'recover'))) {
         act_draftdel('draftdel');
         $ACT = $act = 'edit';
     }
     if ($act == 'save') {
         # Take over save action if translation is in progress
         # or we're starting it
         if (!@file_exists(metaFN($ID, '.translate')) && empty($_REQUEST['translate'])) {
             return;
         }
         if (!checkSecurityToken()) {
             return;
         }
         # We're starting a translation
         if (!@file_exists(metaFN($ID, '.translate')) && !empty($_REQUEST['translate'])) {
             # Check if the user has permission to start
             # translation in this namespace
             if (!isModerator($ID)) {
                 return;
             }
             # Take the event over
             $event->stopPropagation();
             $event->preventDefault();
             # Save the data but exit if it fails
             $ACT = act_save($act);
             if ($ACT != 'show') {
                 return;
             }
             # Page was deleted, exit
             if (!@file_exists(wikiFN($ID))) {
                 return;
             }
             # Prepare data path
             $datapath = dataPath($ID);
             io_mkdir_p($datapath, 0755, true);
             # Backup the original page
             io_rename(wikiFN($ID), $datapath . '/orig.txt');
             # Backup old revisions
             $revisions = allRevisions($ID);
             foreach ($revisions as $rev) {
                 $tmp = wikiFN($ID, $rev);
                 io_rename($tmp, $datapath . '/' . basename($tmp));
             }
             # Backup meta files
             $metas = metaFiles($ID);
             foreach ($metas as $f) {
                 io_rename($f, $datapath . '/' . basename($f));
             }
             # Generate empty page to hold translated text
             $data = getCleanInstructions($datapath . '/orig.txt');
             saveWikiText($ID, genTranslateFile($data), $SUM, $_REQUEST['minor']);
             $translateMeta = genMeta(count($data));
             # create meta file for current translation state
             io_saveFile(metaFN($ID, '.translate'), serialize($translateMeta));
             # create separate meta file for translation history
             io_saveFile(metaFN($ID, '.translateHistory'), serialize(array('current' => $translateMeta)));
         } else {
             # Translation in progress, take the event over
             $event->preventDefault();
             # Save the data but exit if it fails
             $ACT = act_save($act);
             # Save failed, exit
             if ($ACT != 'show') {
                 return;
             }
             # Save successful, update translation metadata
             $lastrev = getRevisions($ID, 0, 1, 1024);
             updateMeta($ID, getParID(), $lastrev[0]);
         }
     } else {
         if ($act == 'revert') {
             # Take over save action if translation is in progress
             if (!@file_exists(metaFN($ID, '.translate'))) {
                 return;
             }
             if (!checkSecurityToken()) {
                 return;
             }
             # Translation in progress, take the event over
             $event->preventDefault();
             # Save the data but exit if it fails
             $revert = $REV;
             $ACT = act_revert($act);
             # Revert failed, exit
             if ($ACT != 'show') {
//.........这里部分代码省略.........
开发者ID:nextghost,项目名称:Dokutranslate,代码行数:101,代码来源:action.php


示例10: test_full_hierarchy

 function test_full_hierarchy()
 {
     // setup hierachy and test it exists
     $dir = io_mktmpdir();
     $top = dirname($dir);
     $this->assertTrue($dir !== false);
     $this->assertTrue(is_dir($dir));
     $this->assertTrue(io_mkdir_p("{$dir}/foo/bar/baz"));
     $this->assertTrue(is_dir("{$dir}/foo/bar/baz"));
     $this->assertTrue(io_mkdir_p("{$dir}/foobar/bar/baz"));
     $this->assertTrue(is_dir("{$dir}/foobar/bar/baz"));
     // put files
     $this->assertTrue(io_saveFile("{$dir}/testfile.txt", 'foobar'));
     $this->assertFileExists("{$dir}/testfile.txt");
     $this->assertTrue(io_saveFile("{$dir}/foo/testfile.txt", 'foobar'));
     $this->assertFileExists("{$dir}/foo/testfile.txt");
     $this->assertTrue(io_saveFile("{$dir}/foo/bar/baz/testfile.txt", 'foobar'));
     $this->assertFileExists("{$dir}/foo/bar/baz/testfile.txt");
     // delete unsuccessfully
     $this->assertFalse(io_rmdir($dir, false));
     // check result
     clearstatcache();
     $this->assertFileExists("{$dir}/testfile.txt");
     $this->assertFileExists("{$dir}/foo/testfile.txt");
     $this->assertFileExists("{$dir}/foo/bar/baz/testfile.txt");
     $this->assertTrue(is_dir("{$dir}/foo/bar/baz"));
     $this->assertTrue(is_dir("{$dir}/foobar/bar/baz"));
     $this->assertTrue(is_dir($dir));
     $this->assertTrue(is_dir($top));
     // delete successfully
     $this->assertTrue(io_rmdir($dir, true));
     // check result
     clearstatcache();
     $this->assertFileNotExists("{$dir}/testfile.txt");
     $this->assertFileNotExists("{$dir}/foo/testfile.txt");
     $this->assertFileNotExists("{$dir}/foo/bar/baz/testfile.txt");
     $this->assertFalse(is_dir("{$dir}/foo/bar/baz"));
     $this->assertFalse(is_dir("{$dir}/foobar/bar/baz"));
     $this->assertFalse(is_dir($dir));
     $this->assertTrue(is_dir($top));
 }
开发者ID:rsnitsch,项目名称:dokuwiki,代码行数:41,代码来源:io_rmdir.test.php


示例11: _dircopy

 function _dircopy($srcdir, $dstdir)
 {
     io_mkdir_p($dstdir);
     $num = 0;
     if ($curdir = opendir($srcdir)) {
         while ($file = readdir($curdir)) {
             if ($file != '.' && $file != '..') {
                 $srcfile = $srcdir . DIRECTORY_SEPARATOR . $file;
                 $dstfile = $dstdir . DIRECTORY_SEPARATOR . $file;
                 if (is_file($srcfile)) {
                     if (!$this->_copy($srcfile, $dstfile)) {
                         msg(sprintf($this->getLang('error_copying'), $srcfile), -1);
                     } else {
                         $num++;
                     }
                 } else {
                     if (is_dir($srcfile)) {
                         $num += $this->_dircopy($srcfile, $dstfile);
                     }
                 }
             }
         }
         closedir($curdir);
     }
     return $num;
 }
开发者ID:bomberstudios,项目名称:dokuwiki-offline-html,代码行数:26,代码来源:admin.php


示例12: build

 /**
  * Build the document from the template.
  * (code taken from old function 'document_end_scratch')
  *
  * @param string      $doc
  * @param string      $autostyles
  * @param array       $commonstyles
  * @param string      $meta
  * @param string      $userfields
  * @param ODTDefaultStyles $styleset
  * @return mixed
  */
 public function build($doc = null, $meta = null, $userfields = null, $pagestyles = null)
 {
     // for the temp dir
     global $ID;
     // Temp dir
     if (is_dir($this->config->getParam('tmpdir'))) {
         // version > 20070626
         $temp_dir = $this->config->getParam('tmpdir');
     } else {
         // version <= 20070626
         $temp_dir = $this->config->getParam('savedir') . '/cache/tmp';
     }
     $temp_dir = $temp_dir . "/odt/" . str_replace(':', '-', $ID);
     if (is_dir($temp_dir)) {
         io_rmdir($temp_dir, true);
     }
     io_mkdir_p($temp_dir);
     // Extract template
     $template_path = $this->config->getParam('mediadir') . '/' . $this->directory . "/" . $this->template;
     $ok = $this->ZIP->Extract($template_path, $temp_dir);
     if ($ok == -1) {
         throw new Exception(' Error extracting the zip archive:' . $template_path . ' to ' . $temp_dir);
     }
     // Import styles from ODT template
     //$this->styleset->importFromODTFile($temp_dir.'/content.xml', 'office:automatic-styles');
     //$this->styleset->importFromODTFile($temp_dir.'/styles.xml', 'office:styles');
     $autostyles = $this->styleset->export('office:automatic-styles');
     $commonstyles = $this->styleset->export('office:styles');
     // Prepare content
     $missingfonts = $this->styleset->getMissingFonts($temp_dir . '/styles.xml');
     // Insert content
     $old_content = io_readFile($temp_dir . '/content.xml');
     if (strpos($old_content, 'DOKUWIKI-ODT-INSERT') !== FALSE) {
         // Replace the mark
         $this->_odtReplaceInFile('/<text:p[^>]*>DOKUWIKI-ODT-INSERT<\\/text:p>/', $doc, $temp_dir . '/content.xml', true);
     } else {
         // Append to the template
         $this->_odtReplaceInFile('</office:text>', $doc . '</office:text>', $temp_dir . '/content.xml');
     }
     // Cut off unwanted content
     if (strpos($old_content, 'DOKUWIKI-ODT-CUT-START') !== FALSE && strpos($old_content, 'DOKUWIKI-ODT-CUT-STOP') !== FALSE) {
         $this->_odtReplaceInFile('/DOKUWIKI-ODT-CUT-START.*DOKUWIKI-ODT-CUT-STOP/', '', $temp_dir . '/content.xml', true);
     }
     // Insert userfields
     if (strpos($old_content, "text:user-field-decls") === FALSE) {
         // no existing userfields
         $this->_odtReplaceInFile('/<office:text([^>]*)>/U', '<office:text\\1>' . $userfields, $temp_dir . '/content.xml', TRUE);
     } else {
         $this->_odtReplaceInFile('</text:user-field-decls>', substr($userfields, 23), $temp_dir . '/content.xml');
     }
     // Insert styles & fonts
     $value = io_readFile($temp_dir . '/content.xml');
     $original = XMLUtil::getElement('office:automatic-styles', $value);
     $this->_odtReplaceInFile($original, $autostyles, $temp_dir . '/content.xml');
     $value = io_readFile($temp_dir . '/styles.xml');
     $original = XMLUtil::getElement('office:automatic-styles', $value);
     $this->_odtReplaceInFile($original, $autostyles, $temp_dir . '/styles.xml');
     $value = io_readFile($temp_dir . '/styles.xml');
     $original = XMLUtil::getElement('office:styles', $value);
     $this->_odtReplaceInFile($original, $commonstyles, $temp_dir . '/styles.xml');
     $this->_odtReplaceInFile('</office:font-face-decls>', $missingfonts . '</office:font-face-decls>', $temp_dir . '/styles.xml');
     // Insert page styles
     $page = '';
     foreach ($pagestyles as $name => $layout_name) {
         $page .= '<style:master-page style:name="' . $name . '" style:page-layout-name="' . $layout_name . '"/>';
     }
     if (!empty($page)) {
         $this->_odtReplaceInFile('</office:master-styles>', $page . '</office:master-styles>', $temp_dir . '/styles.xml');
     }
     // Add manifest data
     $this->_odtReplaceInFile('</manifest:manifest>', $this->manifest->getExtraContent() . '</manifest:manifest>', $temp_dir . '/META-INF/manifest.xml');
     // Build the Zip
     $this->ZIP->Compress(null, $temp_dir, null);
     io_rmdir($temp_dir, true);
 }
开发者ID:richmahn,项目名称:dokuwiki-plugin-odt,代码行数:87,代码来源:ODTTemplateDH.php


示例13: epub_setup_book_skel

function epub_setup_book_skel($user_title = false)
{
    $dir = epub_get_metadirectory();
    $meta = $dir . 'META-INF';
    $oebps = epub_get_oebps();
    $media_dir = epub_get_data_media() . 'epub';
    io_mkdir_p($meta);
    io_mkdir_p($oebps);
    io_mkdir_p($oebps . 'Images/');
    io_mkdir_p($oebps . 'Text/');
    io_mkdir_p($media_dir);
    io_mkdir_p($oebps . 'Styles/');
    if (isset($_POST['client'])) {
        $user = cleanID(rawurldecode($_POST['client'])) . '/';
        io_mkdir_p($media_dir . '/' . $user);
    }
    $book_id = cleanID(rawurldecode($_POST['book_page']));
    copy(EPUB_DIR . 'scripts/package/my-book.epub', $dir . 'my-book.epub');
    copy(EPUB_DIR . 'scripts/package/container.xml', $dir . 'META-INF/container.xml');
    if (!$user_title) {
        copy(EPUB_DIR . 'scripts/package/title.html', $oebps . 'Text/title.html');
        copy(EPUB_DIR . 'scripts/package/cover.png', $oebps . 'Images/cover.png');
    }
    $zip = epub_zip_handle($dir . 'my-book.epub');
    if ($zip) {
        $zip->addFile(EPUB_DIR . 'scripts/package/container.xml', 'META-INF/container.xml');
        if (!$user_title) {
            $zip->addFile(EPUB_DIR . 'scripts/package/title.html', 'OEBPS/Text/title.html');
            $zip->addFile(EPUB_DIR . 'scripts/package/cover.png', 'OEBPS/Images/cover.png');
        }
    }
}
开发者ID:omusico,项目名称:isle-web-framework,代码行数:32,代码来源:epub_utils.php


示例14: _traverse

 /**
  * Traverse over the given dir and compare it to the DokuWiki dir
  *
  * Checks what files need an update, tests for writability and copies
  *
  * @param string $dir
  * @param bool   $dryrun do not copy but only check permissions
  * @return bool
  */
 private function _traverse($dir, $dryrun)
 {
     $base = $this->tgzdir;
     $ok = true;
     $dh = @opendir($base . '/' . $dir);
     if (!$dh) {
         return false;
     }
     while (($file = readdir($dh)) !== false) {
         if ($file == '.' || $file == '..') {
             continue;
         }
         $from = "{$base}/{$dir}/{$file}";
         $to = DOKU_INC . "{$dir}/{$file}";
         if (is_dir($from)) {
             if ($dryrun) {
                 // just check for writability
                 if (!is_dir($to)) {
                     if (is_dir(dirname($to)) && !is_writable(dirname($to))) {
                         $this->_warn('<b>' . $this->getLang('tv_noperm') . '</b>', hsc("{$dir}/{$file}"));
                         $ok = false;
                     }
                 }
             }
             // recursion
             if (!$this->_traverse("{$dir}/{$file}", $dryrun)) {
                 $ok = false;
             }
         } else {
             $fmd5 = md5(@file_get_contents($from));
             $tmd5 = md5(@file_get_contents($to));
             if ($fmd5 != $tmd5 || !file_exists($to)) {
                 if ($dryrun) {
                     // just check for writability
                     if (file_exists($to) && !is_writable($to) || !file_exists($to) && is_dir(dirname($to)) && !is_writable(dirname($to))) {
                         $this->_warn('<b>' . $this->getLang('tv_noperm') . '</b>', hsc("{$dir}/{$file}"));
                         $ok = false;
                     } else {
                         $this->_say($this->getLang('tv_upd'), hsc("{$dir}/{$file}"));
                     }
                 } else {
                     // check dir
                     if (io_mkdir_p(dirname($to))) {
                         // copy
                         if (!copy($from, $to)) {
                             $this->_warn('<b>' . $this->getLang('tv_nocopy') . '</b>', hsc("{$dir}/{$file}"));
                             $ok = false;
                         } else {
                             $this->_say($this->getLang('tv_done'), hsc("{$dir}/{$file}"));
                         }
                     } else {
                         $this->_warn('<b>' . $this->getLang('tv_nodir') . '</b>', hsc("{$dir}"));
                         $ok = false;
                     }
                 }
             }
         }
     }
     closedir($dh);
     return $ok;
 }
开发者ID:Verber,项目名称:dokuwiki-plugin-upgrade,代码行数:70,代码来源:admin.php


示例15: _dirApp

 function _dirApp($d)
 {
     //  map to dokuwiki function (its more robust)
     return io_mkdir_p($d);
 }
开发者ID:stretchyboy,项目名称:dokuwiki,代码行数:5,代码来源:TarLib.class.php


示例16: externalmedia

 function externalmedia($src, $title = NULL, $align = NULL, $width = NULL, $height = NULL, $cache = NULL, $linking = NULL)
 {
     global $conf;
     global $ID;
     list($ext, $mime) = mimetype($src);
     if (substr($mime, 0, 5) == 'image') {
         $tmp_dir = $conf['tmpdir'] . "/odt";
         $tmp_name = $tmp_dir . "/" . md5($src) . '.' . $ext;
         $final_name = 'Pictures/' . md5($tmp_name) . '.' . $ext;
         if (!isset($this->manifest[$final_name])) {
             $client = new DokuHTTPClient();
             $img = $client->get($src);
             if ($img === FALSE) {
                 $tmp_name = $src;
                 // fallback to a simple link
             } else {
                 if (!is_dir($tmp_dir)) {
                     io_mkdir_p($tmp_dir);
                 }
                 $tmp_img = fopen($tmp_name, "w") or die("Can't create temp file {$tmp_img}");
                 fwrite($tmp_img, $img);
                 fclose($tmp_img);
             }
         }
         $this->_odtAddImage($tmp_name, $width, $height, $align, $title);
         if (file_exists($tmp_name)) {
             unlink($tmp_name);
         }
     } else {
         $this->externallink($src, $title);
     }
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:32,代码来源:renderer.php


示例17: _create_dir

 function _create_dir($path)
 {
     global $conf;
     $res = init_path($path);
     if (empty($res)) {
         // let's create it, recursively
         $res = io_mkdir_p($path);
         //$res = mkdir($path, $conf['dmode'], true);
         if (!$res) {
             die("Unable to create directory {$path}, please create it.");
         }
     }
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:13,代码来源:config.php


示例18: document_end_template

 /**
  * Closes the document using a template
  */
 function document_end_template()
 {
     global $conf, $ID;
     // for the temp dir
     // Temp dir
     if (is_dir($conf['tmpdir'])) {
         $temp_dir = $conf['tmpdir'];
         // version > 20070626
     } else {
         $temp_dir = $conf['savedir'] . '/cache/tmp';
         // version <= 20070626
     }
     $this->temp_dir = $temp_dir . "/odt/" . str_replace(':', '-', $ID);
     if (is_dir($this->temp_dir)) {
         $this->io_rm_rf($this->temp_dir);
     }
     io_mkdir_p($this->temp_dir);
     // Extract template
     $template_path = $conf['mediadir'] . '/' . $this->getConf("tpl_dir") . "/" . $this->template;
     $this->ZIP->Extract($template_path, $this->temp_dir);
     // Prepare content
     $autostyles = $this->_odtAutoStyles();
     $missingstyles = $this->_odtStyles();
     $missingfonts = $this->_odtFonts();
     $userfields = $this->_odtUserFields();
     // Insert content
     $old_content = io_readFile($this->temp_dir . '/content.xml');
     if (strpos($old_content, 'DOKUWIKI-ODT-INSERT') !== FALSE) {
         // Replace the mark
         $this->_odtReplaceInFile('/<text:p[^>]*>DOKUWIKI-ODT-INSERT<\\/text:p>/', $this->doc, $this->temp_dir . '/content.xml', true);
     } else {
         // Append to the template
         $this->_odtReplaceInFile('</office:text>', $this->doc . '</office:text>', $this->temp_dir . '/content.xml');
     }
     // Cut off unwanted content
     if (strpos($old_content, 'DOKUWIKI-ODT-CUT-START') !== FALSE && strpos($old_content, 'DOKUWIKI-ODT-CUT-STOP') !== FALSE) {
         $this->_odtReplaceInFile('/DOKUWIKI-ODT-CUT-START.*DOKUWIKI-ODT-CUT-STOP/', '', $this->temp_dir . '/content.xml', true);
     }
     // Insert userfields
     if (strpos($old_content, "text:user-field-decls") === FALSE) {
         // no existing userfields
         $this->_odtReplaceInFile('/<office:text([^>]*)>/U', '<office:text\\1>' . $userfields, $this->temp_dir . '/content.xml', TRUE);
     } else {
         $this->_odtReplaceInFile('</text:user-field-decls>', substr($userfields, 23), $this->temp_dir . '/content.xml');
     }
     // Insert styles & fonts
     $this->_odtReplaceInFile('</office:automatic-styles>', substr($autostyles, 25), $this->temp_dir . '/content.xml');
     $this->_odtReplaceInFile('</office:automatic-styles>', substr($autostyles, 25), $this->temp_dir . '/styles.xml');
     $this->_odtReplaceInFile('</office:styles>', $missingstyles . '</office:styles>', $this->temp_dir . '/styles.xml');
     $this->_odtReplaceInFile('</office:font-face-decls>', $missingfonts . '</office:font-face-decls>', $this->temp_dir . '/styles.xml');
     // Build the Zip
     $this->ZIP->Compress(null, $this->temp_dir, null);
     $this->io_rm_rf($this->temp_dir);
 }
开发者ID:lorea,项目名称:Hydra-dev,代码行数:57,代码来源:renderer.php


示例19: _dirApp

 function _dirApp($d)
 {
     //  map to dokuwiki function (its more robust)
     return io_mkdir_p($d);
     /*
         $d = explode('/', $d);
         $base = '';
     
         foreach($d as $f) {
           if(!is_dir($base.$f)) {
             $ok = @mkdir($base.$f, 0777);
             if(!$ok) return false;
           }
           $base .= "$f/";
         }
     */
 }
开发者ID:JVS-IS,项目名称:ICONITO-EcoleNumerique,代码行数:17,代码来源:TarLib.class.php


示例20: manual_lock

 /**
  * Locks the site manually, must unlock manually
  *
  * @return  integer  2: already locked, 1: success, 0: fail
  */
 function manual_lock()
 {
     if (is_file($this->manual_lock_file)) {
         return 2;
     }
     @io_mkdir_p(dirname($this->manual_lock_file));
     @touch($this->manual_lock_file);
     if (is_file($this->manual_lock_file)) {
         return 1;
     }
     return 0;
 }
开发者ID:omusico,项目名称:isle-web-framework,代码行数:17,代码来源:helper.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP io_readFile函数代码示例发布时间:2022-05-15
下一篇:
PHP io_makeFileDir函数代码示例发布时间: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