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

PHP file_directory_path函数代码示例

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

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



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

示例1: manipulateImage

 function manipulateImage($parameterArray = null, $dsid, $file, $file_ext, $folder)
 {
     $height = $parameterArray['height'];
     $width = $parameterArray['width'];
     $file_suffix = '_' . $dsid . '.' . $file_ext;
     $returnValue = TRUE;
     $image = imageapi_image_open($file);
     if (!$image) {
         drupal_set_message(t("Error opening image"));
         return false;
     }
     if (!empty($height) || !empty($width)) {
         $returnValue = imageapi_image_scale($image, $height, $width);
     }
     if (!$returnValue) {
         drupal_set_message(t("Error scaling image"));
         return $returnValue;
     }
     $filename = substr(strrchr($file, '/'), 1);
     $output_path = $_SERVER['DOCUMENT_ROOT'] . base_path() . file_directory_path() . '/' . $folder . '/' . $filename . $file_suffix;
     $returnValue = imageapi_image_close($image, $output_path);
     if ($returnValue) {
         $_SESSION['fedora_ingest_files']["{$dsid}"] = $file . $file_suffix;
         return TRUE;
     } else {
         return $returnValue;
     }
 }
开发者ID:ratzeni,项目名称:epistemetec,代码行数:28,代码来源:ImageManipulation.php


示例2: satellite_header_background

/**
 * Select a diferent footer image at every reload. 
 *
 * @return CSS
 */
function satellite_header_background()
{
    global $base_path;
    $theme = drupal_get_path('theme', 'satellite');
    $file_directory_path = file_directory_path();
    $token = token_get_values('esn');
    $data = array_combine($token->tokens, $token->values);
    $css = '';
    if (file_exists($data['header'])) {
        if ($data['default_header'] == 1) {
            $css .= '<style type="text/css" media="all"> #wrapper #container #footer-fade {background: url("' . $base_path . $file_directory_path . '/imagecache/header/' . $data['header'] . '") top left no-repeat;}</style>';
        }
        if ($data['default_header'] == 0) {
            $css .= '<style type="text/css" media="all"> #wrapper #container #footer-fade {background: url("' . $base_path . $file_directory_path . '/imagecache/header/' . $data['header'] . '") top left no-repeat;}</style>';
            $css .= '<style type="text/css" media="all"> #shadow-top { background: transparent url("' . $base_path . $theme . '/images/layout/shadow_top_clean.png") top center no-repeat;}</style>';
        }
        if ($data['default_header'] == 2) {
            $css .= '<style type="text/css" media="all"> #wrapper #container #footer-fade { background: transparent url("' . $base_path . $file_directory_path . '/imagecache/header_star/' . $data['header'] . '") no-repeat 0 35px;}</style>';
            $css .= '<style type="text/css" media="all"> #shadow-top { background: transparent url("' . $base_path . $theme . '/images/layout/shadow_top_clean.png") top center no-repeat;}</style>';
        }
    } else {
        $css .= '<style type="text/css" media="all">  #wrapper #container #header #header-title {background: url("' . $base_path . $theme . '/images/default_header.png") top left no-repeat;}</style>';
    }
    return $css;
}
开发者ID:pvhee,项目名称:esn_satellite,代码行数:30,代码来源:template.php


示例3: singular_settings

/**
 * Implementation of hook_settings() for themes.
 */
function singular_settings($settings)
{
    // Add js & css
    drupal_add_css('misc/farbtastic/farbtastic.css', 'module', 'all', FALSE);
    drupal_add_js('misc/farbtastic/farbtastic.js');
    drupal_add_js(drupal_get_path('theme', 'singular') . '/js/settings.js');
    drupal_add_css(drupal_get_path('theme', 'singular') . '/css/settings.css');
    file_check_directory(file_directory_path(), FILE_CREATE_DIRECTORY, 'file_directory_path');
    // Check for a new uploaded logo, and use that instead.
    if ($file = file_save_upload('background_file', array('file_validate_is_image' => array()))) {
        $parts = pathinfo($file->filename);
        $filename = 'singular_background.' . $parts['extension'];
        if (file_copy($file, $filename, FILE_EXISTS_REPLACE)) {
            $settings['background_path'] = $file->filepath;
        }
    }
    $form = array();
    $form['layout'] = array('#title' => t('Layout'), '#type' => 'select', '#options' => array('fixed' => t('Fixed width'), 'fluid' => t('Fluid width')), '#default_value' => !empty($settings['layout']) ? $settings['layout'] : 'fixed');
    $form['messages'] = array('#type' => 'fieldset', '#tree' => FALSE, '#title' => t('Autoclose messages'), '#descriptions' => t('Select the message types to close automatically after a few seconds.'));
    $form['messages']['autoclose'] = array('#type' => 'checkboxes', '#options' => array('status' => t('Status'), 'warning' => t('Warning'), 'error' => t('Error')), '#default_value' => !empty($settings['autoclose']) ? $settings['autoclose'] : array('status'));
    $form['style'] = array('#title' => t('Styles'), '#type' => 'select', '#options' => singular_get_styles(), '#default_value' => !empty($settings['style']) ? $settings['style'] : 'sea');
    $form['custom'] = array('#tree' => FALSE, '#type' => 'fieldset', '#attributes' => array('class' => $form['style']['#default_value'] == 'custom' ? 'singular-custom-settings' : 'singular-custom-settings hidden'));
    $form['custom']['background_file'] = array('#type' => 'file', '#title' => t('Background image'), '#maxlength' => 40);
    if (!empty($settings['background_path'])) {
        $form['custom']['background_preview'] = array('#type' => 'markup', '#value' => !empty($settings['background_path']) ? theme('image', $settings['background_path'], NULL, NULL, array('width' => '100'), FALSE) : '');
    }
    $form['custom']['background_path'] = array('#type' => 'value', '#value' => !empty($settings['background_path']) ? $settings['background_path'] : '');
    $form['custom']['background_color'] = array('#title' => t('Background color'), '#type' => 'textfield', '#size' => '7', '#maxlength' => '7', '#default_value' => !empty($settings['background_color']) ? $settings['background_color'] : '#888888', '#suffix' => '<div id="singular-colorpicker"></div>');
    $form['custom']['background_repeat'] = array('#title' => t('Tile'), '#type' => 'select', '#options' => array('no-repeat' => t('Don\'t tile'), 'repeat-x' => t('Horizontal'), 'repeat-y' => t('Vertical'), 'repeat' => t('Both')), '#default_value' => !empty($settings['background_repeat']) ? $settings['background_repeat'] : 'no-repeat');
    return $form;
}
开发者ID:szczym,项目名称:tutturu,代码行数:34,代码来源:theme-settings.php


示例4: __construct

 public function __construct($wsdl_root, $wsdl_keys = array('Authentication' => NULL, 'DataAccess' => NULL), $ui_root)
 {
     $this->wsdl_root = trim($wsdl_root, '/') . '/';
     $this->wsdl_keys = $wsdl_keys;
     $this->ui_root = trim($ui_root, '/') . '/';
     $this->cache_dir = realpath(file_directory_path());
     $this->errors = array();
 }
开发者ID:natemow,项目名称:samples,代码行数:8,代码来源:class.isgweb_wrapper.php


示例5: _ad_blueprint_write_css

function _ad_blueprint_write_css()
{
    // Set the location of the custom.css file
    $file_path = file_directory_path() . '/ad_blueprint/custom.css';
    // If the directory doesn't exist, create it
    file_check_directory(dirname($file_path), FILE_CREATE_DIRECTORY);
    // Generate the CSS
    $file_contents = _ad_blueprint_build_css();
    $output = '<div class="description">' . t('This CSS is generated by the settings chosen above and placed in the files directory: ' . l($file_path, $file_path) . '. The file is generated each time this page (and only this page) is loaded. <strong class="marker">Make sure to refresh your page to see the changes</strong>') . '</div>';
    file_save_data($file_contents, $file_path, FILE_EXISTS_REPLACE);
    return $output;
}
开发者ID:hoangbktech,项目名称:bhl-bits,代码行数:12,代码来源:theme-settings.php


示例6: log

 function log($str)
 {
     if (!file_exists(file_directory_path() . '/kaltura.log')) {
         $klog = fopen(file_directory_path() . '/kaltura.log', 'w');
         if ($klog) {
             fclose($klog);
         }
     }
     if (file_exists(file_directory_path() . '/kaltura.log')) {
         $klog = fopen(file_directory_path() . '/kaltura.log', 'a');
         if (!$klog) {
             watchdog('kaltura client', $str);
         } else {
             fwrite($klog, $str . PHP_EOL);
             fclose($klog);
         }
     }
 }
开发者ID:avlsx,项目名称:flers_haja,代码行数:18,代码来源:kaltura_logger.php


示例7: add_datastream_from_file

 function add_datastream_from_file($datastream_file, $datastream_id, $datastream_label = null, $datastream_mimetype = '', $controlGroup = 'M')
 {
     module_load_include('php', 'fedora_repository', 'mimetype');
     if (empty($datastream_mimetype)) {
         // Get mime type from the file extension.
         $mimetype_helper = new mimetype();
         $datastream_mimetype = $mimetype_helper->getType($datastream_file);
     }
     $original_path = $datastream_file;
     // Temporarily move file to a web-accessible location.
     file_copy($datastream_file, file_directory_path());
     $datastream_url = drupal_urlencode($datastream_file);
     $url = file_create_url($datastream_url);
     $return_value = $this->add_datastream_from_url($url, $datastream_id, $datastream_label, $datastream_mimetype, $controlGroup);
     if ($original_path != $datastream_file) {
         file_delete($datastream_file);
     }
     return $return_value;
 }
开发者ID:ratzeni,项目名称:islandora,代码行数:19,代码来源:fedora_item.php


示例8: export_collection

/**
 * Exports a fedora collection object and all of its children in a format
 * that will let you import them into another repository.
 * @param <type> $format
 */
function export_collection($collection_pid, $relationship = 'isMemberOfCollection', $format = 'info:fedora/fedora-system:FOXML-1.1')
{
    $collection_item = new Fedora_Item($collection_pid);
    $foxml = $collection_item->export_as_foxml();
    $file_dir = file_directory_path();
    // Create a temporary directory to contain the exported FOXML files.
    $container = tempnam($file_dir, 'export_');
    file_delete($container);
    print $container;
    if (mkdir($container) && mkdir($container . '/' . $collection_pid)) {
        $foxml_dir = $container . '/' . $collection_pid;
        $file = fopen($foxml_dir . '/' . $collection_pid . '.xml', 'w');
        fwrite($file, $foxml);
        fclose($file);
        $member_pids = get_related_items_as_array($collection_pid, $relationship);
        foreach ($member_pids as $member) {
            $file = fopen($foxml_dir . '/' . $member . '.xml', 'w');
            $item = new Fedora_Item($member);
            $item_foxml = $item->export_as_foxml();
            fwrite($file, $item_foxml);
            fclose($file);
        }
        if (system("cd {$container};zip -r {$collection_pid}.zip {$collection_pid}/* >/dev/null") == 0) {
            header("Content-type: application/zip");
            header('Content-Disposition: attachment; filename="' . $collection_pid . '.zip' . '"');
            $fh = fopen($container . '/' . $collection_pid . '.zip', 'r');
            $theData = fread($fh, filesize($container . '/' . $collection_pid . '.zip'));
            fclose($fh);
            echo $theData;
        }
        if (file_exists($container . '/' . $collection_pid)) {
            system("rm -rf {$container}");
            // I'm sorry.
        }
    } else {
        drupal_set_message("Error creating temp directory for batch export.", 'error');
        return false;
    }
    return true;
}
开发者ID:ratzeni,项目名称:islandora,代码行数:45,代码来源:fedora_collection.php


示例9: hook_custom_formatters_field_prepare

/**
 * Prepare a CCK field array for use with Devel Generate.
 *
 * @return
 *   A keyed array with keys defined as necessary for the $field array passed
 *   to your modules implementation of Devel Generates hook_content_generate().
 */
function hook_custom_formatters_field_prepare()
{
    file_check_directory($path = file_directory_path() . '/._tmp.custom_formatters', TRUE);
    return array('widget' => array('file_extensions' => 'jpg png', 'file_path' => '._tmp.custom_formatters'));
}
开发者ID:aakb,项目名称:Urban-media-space,代码行数:12,代码来源:custom_formatters.api.php


示例10: array

<?php

/**
 * Insert this code in the phpfilter of the content type 'Setting', text field 'Section'.
 */
$ya_xml_resources = array('http://center.youthagora.org/xml/esn-satellite/sections.xml', 'http://galaxy.esn.org/sections/xml');
$ya_xml_local_file = file_directory_path() . '/' . 'sections.xml';
if (file_exists($ya_xml_local_file)) {
    array_unshift($ya_xml_resources, $ya_xml_local_file);
}
$ya_xml = false;
foreach ($ya_xml_resources as $ya_xml_resource) {
    $ya_xml = @simplexml_load_file($ya_xml_resource, 'SimpleXMLElement', LIBXML_NOCDATA);
    if ($ya_xml) {
        break;
    }
}
if ($ya_xml) {
    foreach ($ya_xml->section as $item) {
        $elements['id'] = (string) $item->id;
        $elements['sc'] = (string) $item->sc;
        $elements['sectionname'] = (string) $item->sectionname;
        $elements['l'] = (string) $item->l;
        $elements['universityname'] = (string) $item->universityname;
        $elements['street'] = (string) $item->street;
        $elements['postaladdress'] = (string) $item->postaladdress;
        $elements['telephonenumber'] = (string) $item->telephonenumber;
        $elements['facsimiletelephonenumber'] = (string) $item->facsimiletelephonenumber;
        $elements['mail'] = (string) $item->mail;
        $elements['universitywebsite'] = (string) $item->universitywebsite;
        $elements['sectionpin'] = (string) $item->sectionpin;
开发者ID:pvhee,项目名称:esn_satellite,代码行数:31,代码来源:section.php


示例11: node_save

$issue->field_operating_system[0]['value'] = 'Other';
//Body has full OS
$issue->changed = $issue->created;
$issue->format = 5;
// Markdown, allows filtered HTML, as well.
$issue->comment = 2;
// Allow comments, otherwise they're invisible!
if ($private) {
    $issue->private = 1;
}
node_save($issue);
$nid = $issue->nid;
if ($validation || $configcheck || $collected) {
    // Process attachments
    $issue_dir = variable_get('project_directory_issues', 'issues');
    $dest = file_directory_path() . '/' . $issue_dir;
    // Drupal's standard files path
    if (!file_check_directory($dest)) {
        echo "<br>Error processing attachments.  Event has been logged and an administrator notified.\n";
        error_log("Attachment directory {$dest} does not exist or is not writable.");
        exit;
    }
    foreach (array($validation, $configcheck, $collected) as $attachment) {
        if (empty($attachment)) {
            continue;
        }
        // Generate a randomish unique file name
        $file_id = $nid . "_" . time() . posix_getpid() . ++$acount;
        // Save the file and put the path into $file
        $file = file_save_data($attachment, "{$dest}/{$file_id}", $replace = FILE_EXISTS_RENAME);
        // Make it a node in Drupal
开发者ID:swelljoe,项目名称:project_issue_virtualmin,代码行数:31,代码来源:bug.php


示例12: ingestAudio

 function ingestAudio($file)
 {
     $filename = substr(strrchr($file, '/'), 1);
     $output_path = $_SERVER['DOCUMENT_ROOT'] . base_path() . file_directory_path() . '/' . $filename;
     $_SESSION['fedora_ingest_files']["MP3"] = $output_path;
 }
开发者ID:ratzeni,项目名称:epistemetec,代码行数:6,代码来源:FileManipulation.php


示例13: install_main


//.........这里部分代码省略.........
    module_list(TRUE, FALSE, FALSE, $module_list);
    drupal_load('module', 'system');
    drupal_load('module', 'filter');
    // Install profile chosen, set the global immediately.
    // This needs to be done before the theme cache gets
    // initialized in drupal_maintenance_theme().
    if (!empty($_GET['profile'])) {
        $profile = preg_replace('/[^a-zA-Z_0-9]/', '', $_GET['profile']);
    }
    // Set up theme system for the maintenance page.
    drupal_maintenance_theme();
    // Check existing settings.php.
    $verify = install_verify_settings();
    if ($verify) {
        // Since we have a database connection, we use the normal cache system.
        // This is important, as the installer calls into the Drupal system for
        // the clean URL checks, so we should maintain the cache properly.
        require_once './includes/cache.inc';
        $conf['cache_inc'] = './includes/cache.inc';
        // Establish a connection to the database.
        require_once './includes/database.inc';
        db_set_active();
        // Check if Drupal is installed.
        $task = install_verify_drupal();
        if ($task == 'done') {
            install_already_done_error();
        }
    } else {
        // Since no persistent storage is available yet, and functions that check
        // for cached data will fail, we temporarily replace the normal cache
        // system with a stubbed-out version that short-circuits the actual
        // caching process and avoids any errors.
        require_once './includes/cache-install.inc';
        $conf['cache_inc'] = './includes/cache-install.inc';
        $task = NULL;
    }
    // No profile was passed in GET, ask the user.
    if (empty($_GET['profile'])) {
        if ($profile = install_select_profile()) {
            install_goto("install.php?profile={$profile}");
        } else {
            install_no_profile_error();
        }
    }
    // Load the profile.
    require_once "./profiles/{$profile}/{$profile}.profile";
    // Locale selection
    if (!empty($_GET['locale'])) {
        $install_locale = preg_replace('/[^a-zA-Z_0-9\\-]/', '', $_GET['locale']);
    } elseif (($install_locale = install_select_locale($profile)) !== FALSE) {
        install_goto("install.php?profile={$profile}&locale={$install_locale}");
    }
    // Tasks come after the database is set up
    if (!$task) {
        global $db_url;
        if (!$verify && !empty($db_url)) {
            // Do not install over a configured settings.php.
            install_already_done_error();
        }
        // Check the installation requirements for Drupal and this profile.
        install_check_requirements($profile, $verify);
        // Verify existence of all required modules.
        $modules = drupal_verify_profile($profile, $install_locale);
        // If any error messages are set now, it means a requirement problem.
        $messages = drupal_set_message();
        if (!empty($messages['error'])) {
            install_task_list('requirements');
            drupal_set_title(st('Requirements problem'));
            print theme('install_page', '');
            exit;
        }
        // Change the settings.php information if verification failed earlier.
        // Note: will trigger a redirect if database credentials change.
        if (!$verify) {
            install_change_settings($profile, $install_locale);
        }
        // The default lock implementation uses a database table,
        // so we cannot use it for install, but we still need
        // the API functions available.
        require_once './includes/lock-install.inc';
        $conf['lock_inc'] = './includes/lock-install.inc';
        lock_init();
        // Install system.module.
        drupal_install_system();
        // Ensure that all of Drupal's standard directories have appropriate
        // .htaccess files. These directories will have already been created by
        // this point in the installer, since Drupal creates them during the
        // install_check_requirements() task. Note that we cannot create them any
        // earlier than this, since the code below relies on system.module in order
        // to work.
        file_create_htaccess(file_directory_path());
        file_create_htaccess(file_directory_temp());
        // Save the list of other modules to install for the 'profile-install'
        // task. variable_set() can be used now that system.module is installed
        // and drupal is bootstrapped.
        variable_set('install_profile_modules', array_diff($modules, array('system')));
    }
    // The database is set up, turn to further tasks.
    install_tasks($profile, $task);
}
开发者ID:EWB,项目名称:lrcs,代码行数:101,代码来源:install.php


示例14: getcwd

            $fck_cwd = getcwd();
            chdir($drupal_path);
            require_once './includes/bootstrap.inc';
            drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
            $authenticated = user_access('allow fckeditor file uploads');
            if (isset($_SESSION['FCKeditor']['UserFilesPath'], $_SESSION['FCKeditor']['UserFilesAbsolutePath'])) {
                $GLOBALS['fck_user_files_path'] = $_SESSION['FCKeditor']['UserFilesPath'];
                $GLOBALS['fck_user_files_absolute_path'] = $_SESSION['FCKeditor']['UserFilesAbsolutePath'];
            }
            chdir($fck_cwd);
        }
    }
    return $authenticated;
}
/**
 * Note:
 * Although in FCKeditor 2.5 $Config['Enabled'] is not used anymore,
 * CheckAuthentication() must be called once to initialize session
 * before sending any content
 * Static $authenticated variable is being assigned, so
 * application performance is not affected
 */
$Config['Enabled'] = CheckAuthentication();
if (!empty($fck_user_files_path)) {
    $Config['UserFilesPath'] = $fck_user_files_path;
    $Config['UserFilesAbsolutePath'] = $fck_user_files_absolute_path;
} else {
    // Nothing in session? Shouldn't happen... anyway let's try to upload it in the (almost) right place
    // Path to user files relative to the document root.
    $Config['UserFilesPath'] = strtr(base_path(), array('/modules/fckeditor/fckeditor/editor/filemanager/connectors/php' => '', '/modules/fckeditor/fckeditor/editor/filemanager/browser/default/connectors/php' => '', '/modules/fckeditor/fckeditor/editor/filemanager/upload/php' => '')) . file_directory_path() . '/';
}
开发者ID:leloulight,项目名称:yvalik,代码行数:31,代码来源:filemanager.config.php


示例15: tearDown

 /**
  * Delete created files and temporary files directory, delete the tables created by setUp(),
  * and reset the database prefix.
  */
 protected function tearDown()
 {
     global $db_prefix, $user, $language;
     $emailCount = count(variable_get('simpletest_emails', array()));
     if ($emailCount) {
         $message = format_plural($emailCount, t('!count e-mail was sent during this test.'), t('!count e-mails were sent during this test.'), array('!count' => $emailCount));
         $this->pass($message, t('E-mail'));
     }
     if (preg_match('/simpletest\\d+/', $db_prefix)) {
         // Delete temporary files directory and reset files directory path.
         file_unmanaged_delete_recursive(file_directory_path());
         variable_set('file_directory_path', $this->originalFileDirectory);
         // Remove all prefixed tables (all the tables in the schema).
         $schema = drupal_get_schema(NULL, TRUE);
         $ret = array();
         foreach ($schema as $name => $table) {
             db_drop_table($ret, $name);
         }
         // Return the database prefix to the original.
         $db_prefix = $this->originalPrefix;
         // Return the user to the original one.
         $user = $this->originalUser;
         drupal_save_session(TRUE);
         // Ensure that internal logged in variable and cURL options are reset.
         $this->loggedInUser = FALSE;
         $this->additionalCurlOptions = array();
         // Reload module list and implementations to ensure that test module hooks
         // aren't called after tests.
         module_list(TRUE);
         module_implements(MODULE_IMPLEMENTS_CLEAR_CACHE);
         // Reset the Field API.
         field_cache_clear();
         // Rebuild caches.
         $this->refreshVariables();
         // Reset language.
         $language = $this->originalLanguage;
         if ($this->originalLanguageDefault) {
             $GLOBALS['conf']['language_default'] = $this->originalLanguageDefault;
         }
         // Close the CURL handler.
         $this->curlClose();
     }
 }
开发者ID:unicorn-fail,项目名称:drupal-bootstrap.org,代码行数:47,代码来源:dwtc.php


示例16: tearDown

 /**
  * Delete created files and temporary files directory, delete the tables created by setUp(),
  * and reset the database prefix.
  */
 protected function tearDown()
 {
     global $db_prefix, $user;
     if (preg_match('/simpletest\\d+/', $db_prefix)) {
         // Delete temporary files directory and reset files directory path.
         file_unmanaged_delete_recursive(file_directory_path());
         variable_set('file_directory_path', $this->originalFileDirectory);
         // Remove all prefixed tables (all the tables in the schema).
         $schema = drupal_get_schema(NULL, TRUE);
         $ret = array();
         foreach ($schema as $name => $table) {
             db_drop_table($ret, $name);
         }
         // Return the database prefix to the original.
         $db_prefix = $this->originalPrefix;
         // Return the user to the original one.
         $user = $this->originalUser;
         drupal_save_session(TRUE);
         // Ensure that internal logged in variable and cURL options are reset.
         $this->loggedInUser = FALSE;
         $this->additionalCurlOptions = array();
         // Reload module list and implementations to ensure that test module hooks
         // aren't called after tests.
         module_list(TRUE);
         module_implements(MODULE_IMPLEMENTS_CLEAR_CACHE);
         // Reset the Field API.
         field_cache_clear();
         // Rebuild caches.
         $this->refreshVariables();
         // Close the CURL handler.
         $this->curlClose();
     }
 }
开发者ID:rolfington,项目名称:drupal,代码行数:37,代码来源:drupal_web_test_case.php


示例17: setUp

 /**
  * Generates a random database prefix, runs the install scripts on the
  * prefixed database and enable the specified modules. After installation
  * many caches are flushed and the internal browser is setup so that the
  * page requests will run on the new prefix. A temporary files directory
  * is created with the same name as the database prefix.
  *
  * @param ...
  *   List of modules to enable for the duration of the test.
  */
 protected function setUp()
 {
     global $db_prefix, $user, $language;
     // Store necessary current values before switching to prefixed database.
     $this->originalLanguage = $language;
     $this->originalLanguageDefault = variable_get('language_default');
     $this->originalPrefix = $db_prefix;
     $this->originalFileDirectory = file_directory_path();
     $this->originalProfile = drupal_get_profile();
     $clean_url_original = variable_get('clean_url', 0);
     // Generate temporary prefixed database to ensure that tests have a clean starting point.
     $db_prefix_new = Database::getConnection()->prefixTables('{simpletest' . mt_rand(1000, 1000000) . '}');
     db_update('simpletest_test_id')->fields(array('last_prefix' => $db_prefix_new))->condition('test_id', $this->testId)->execute();
     $db_prefix = $db_prefix_new;
     // Create test directory ahead of installation so fatal errors and debug
     // information can be logged during installation process.
     // Use temporary files directory with the same prefix as the database.
     $public_files_directory = $this->originalFileDirectory . '/simpletest/' . substr($db_prefix, 10);
     $private_files_directory = $public_files_directory . '/private';
     $temp_files_directory = $private_files_directory . '/temp';
     // Create the directories
     file_prepare_directory($public_files_directory, FILE_CREATE_DIRECTORY | FILE_MODIFY_PERMISSIONS);
     file_prepare_directory($private_files_directory, FILE_CREATE_DIRECTORY);
     file_prepare_directory($temp_files_directory, FILE_CREATE_DIRECTORY);
     $this->generatedTestFiles = FALSE;
     // Log fatal errors.
     ini_set('log_errors', 1);
     ini_set('error_log', $public_files_directory . '/error.log');
     // Reset all statics so that test is performed with a clean environment.
     drupal_static_reset();
     include_once DRUPAL_ROOT . '/includes/install.inc';
     drupal_install_system();
     $this->preloadRegistry();
     // Include the default profile
     variable_set('install_profile', 'standard');
     $profile_details = install_profile_info('standard', 'en');
     // Install the modules specified by the default profile.
     drupal_install_modules($profile_details['dependencies'], TRUE);
     drupal_static_reset('_node_types_build');
     if ($modules = func_get_args()) {
         // Install modules needed for this test.
         drupal_install_modules($modules, TRUE);
     }
     // Because the schema is static cached, we need to flush
     // it between each run. If we don't, then it will contain
     // stale data for the previous run's database prefix and all
     // calls to it will fail.
     drupal_get_schema(NULL, TRUE);
     // Run default profile tasks.
     $install_state = array();
     drupal_install_modules(array('standard'), TRUE);
     // Rebuild caches.
     node_types_rebuild();
     actions_synchronize();
     _drupal_flush_css_js();
     $this->refreshVariables();
     $this->checkPermissions(array(), TRUE);
     // Log in with a clean $user.
     $this->originalUser = $user;
     drupal_save_session(FALSE);
     $user = user_load(1);
     // Restore necessary variables.
     variable_set('install_task', 'done');
     variable_set('clean_url', $clean_url_original);
     variable_set('site_mail', '[email protected]');
     // Set up English language.
     unset($GLOBALS['conf']['language_default']);
     $language = language_default();
     // Set path variables
     variable_set('file_public_path', $public_files_directory);
     variable_set('file_private_path', $private_files_directory);
     variable_set('file_temporary_path', $temp_files_directory);
     // Use the test mail class instead of the default mail handler class.
     variable_set('mail_system', array('default-system' => 'TestingMailSystem'));
     drupal_set_time_limit($this->timeLimit);
 }
开发者ID:jacobSingh,项目名称:drupal,代码行数:86,代码来源:drupal_web_test_case.php


示例18: budgets_supplier_form_submit

function budgets_supplier_form_submit($form_id, &$form_values)
{
    $supplier =& $form_values['values'];
    guifi_log(GUIFILOG_TRACE, 'function budgets_supplier_submit()', $supplier);
    /*
     * Delete logo
     */
    if (isset($supplier['Delete'])) {
        $result = file_delete($supplier['logo']);
        guifi_log(GUIFILOG_TRACE, 'function budgets_supplier_submit(DELETE)', $result);
        $supplier['logo'] = null;
        $form_values['#redirect'] = FALSE;
        $form_values['rebuild'] = TRUE;
        return;
    }
    #this leads us to sites/mysite.example.com/files/
    $dir = file_directory_path();
    $dir .= '/suppliers';
    guifi_log(GUIFILOG_TRACE, 'function budgets_supplier_submit(DIR)', $dir);
    # unlike form submissions, multipart form submissions are not in
    # $form_state, but rather in $FILES, which requires more checking
    if (isset($_FILES) && !empty($_FILES) && $_FILES['files']['size']['logo'] != 0) {
        #this structure is kind of wacky
        $name = $_FILES['files']['name']['logo'];
        $size = $_FILES['files']['size']['logo'];
        $type = $_FILES['files']['type']['logo'];
        #this is the actual place where we store the file
        $file = file_save_upload('logo', array(), $dir);
        if ($file) {
            drupal_set_message(t('You uploaded %name', array('%name' => $name)));
            guifi_log(GUIFILOG_TRACE, 'file', $file->filepath);
            $supplier['logo'] = $file->filepath;
            file_set_status($file, FILE_STATUS_PERMANENT);
        } else {
            drupal_set_message("Something went wrong saving your file.");
        }
    } else {
        drupal_set_message("Your file doesn't appear to be here.");
    }
    $form_values['#redirect'] = FALSE;
    $form_values['rebuild'] = TRUE;
}
开发者ID:itorres,项目名称:drupal-budgets,代码行数:42,代码来源:supplier.inc.php


示例19: tearDown

 /**
  * Delete created files and temporary files directory, delete the tables created by setUp(),
  * and reset the database prefix.
  */
 function tearDown()
 {
     global $db_prefix;
     if (preg_match('/simpletest\\d+/', $db_prefix)) {
         // Delete temporary files directory and reset files directory path.
         simpletest_clean_temporary_directory(file_directory_path());
         variable_set('file_directory_path', $this->original_file_directory);
         $schema = drupal_get_schema(NULL, TRUE);
         $ret = array();
         foreach ($schema as $name => $table) {
             db_drop_table($ret, $name);
         }
         $db_prefix = $this->db_prefix_original;
         $this->_logged_in = FALSE;
         $this->curlClose();
     }
     parent::tearDown();
 }
开发者ID:sdboyer,项目名称:sdboyer-test,代码行数:22,代码来源:drupal_web_test_case.php


示例20: tearDown

 /**
  * Delete created files and temporary files directory, delete the tables created by setUp(),
  * and reset the database prefix.
  */
 protected function tearDown()
 {
     global $db_prefix;
     if (preg_match('/simpletest\\d+/', $db_prefix)) {
         // Delete temporary files directory and reset files directory path.
         simpletest_clean_temporary_directory(file_directory_path());
         variable_set('file_directory_path', $this->originalFileDirectory);
         // Remove all prefixed tables (all the tables in the schema).
         $schema = drupal_get_schema(NULL, TRUE);
         $ret = array();
         foreach ($schema as $name => $table) {
             db_drop_table($ret, $name);
         }
         // Return the database prefix to the original.
         $db_prefix = $this->originalPrefix;
         // Ensure that the internal logged in variable is reset.
         $this->isLoggedIn = FALSE;
         // Reload module list and implementations to ensure that test module hooks
         // aren't called after tests.
         module_list(TRUE);
         module_implements(MODULE_IMPLEMENTS_CLEAR_CACHE);
         // Rebuild caches.
         $this->refreshVariables();
         // Close the CURL handler.
         $this->curlClose();
     }
 }
开发者ID:springnet,项目名称:drupal,代码行数:31,代码来源:drupal_web_test_case.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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