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

PHP fileExistsInPath函数代码示例

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

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



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

示例1: beforeFilter

 /**
  *
  * before filter
  *
  * @return void
  */
 public function beforeFilter()
 {
     parent::beforeFilter();
     $this->Auth->allow();
     if (!fileExistsInPath(APP . DS . 'tmp' . DS . 'newsletter_init.lock')) {
         $this->init();
     }
 }
开发者ID:abdullahshariar,项目名称:cake2-newsletter-plugin,代码行数:14,代码来源:NewslettersController.php


示例2: uploadFile

 private function uploadFile($fileCtrl, $imgName, $cat, $oldFile = null)
 {
     $dir_path = $this->getUploadFileDir($cat);
     $name = $imgName . "." . $this->getFileExtension($fileCtrl);
     if ($imgName && $fileCtrl['tmp_name'] && $fileCtrl['size'] < $this->maxfilesize) {
         if ($oldFile) {
             if (fileExistsInPath($dir_path . $oldFile)) {
                 unlink($dir_path . $oldFile);
             }
         }
         return move_uploaded_file($fileCtrl['tmp_name'], $dir_path . $name);
         //return $name;
     } else {
         return "File size has exceeded the limit. Maximum: " . $this->maxfilesize . " bytes can be allowed.";
     }
 }
开发者ID:iqbaltiger,项目名称:cakephp-project,代码行数:16,代码来源:UploaderComponent.php


示例3: loadComponent

/**
 * Loads a component
 *
 * @param  string  $name Name of component
 * @return boolean Success
 */
function loadComponent($name)
{
    $paths = Configure::getInstance();
    if ($name === null) {
        return true;
    }
    if (!class_exists($name . 'Component')) {
        $name = Inflector::underscore($name);
        foreach ($paths->componentPaths as $path) {
            if (file_exists($path . $name . '.php')) {
                require $path . $name . '.php';
                return true;
            }
        }
        if ($component_fn = fileExistsInPath(LIBS . 'controller' . DS . 'components' . DS . $name . '.php')) {
            if (file_exists($component_fn)) {
                require $component_fn;
                return true;
            } else {
                return false;
            }
        }
    } else {
        return true;
    }
}
开发者ID:hilkeros,项目名称:MMM-php-cake,代码行数:32,代码来源:basics.php


示例4: makeJsonObject

 /**
  * Creates the json object used for map rendering
  *     
  * @param array $results listings
  * @param mixed $fields  custom fields, required when using the GeoMaps module
  * @param mixed $options mapUI options to override globals when using GeoMaps module
  */
 function makeJsonObject(&$results, &$fields = array(), $options = array())
 {
     $www_base = array_shift(pathinfo(WWW_ROOT));
     // Required for thumbnail path
     $paths = array(S2Paths::get('jreviews', 'S2_VIEWS_OVERRIDES') . 'themes' . DS . $this->c->Config->template . DS . 'theme_images' . DS, S2Paths::get('jreviews', 'S2_VIEWS') . 'themes' . DS . $this->c->Config->template . DS . 'theme_images' . DS, S2Paths::get('jreviews', 'S2_VIEWS_OVERRIDES') . 'themes' . DS . 'default' . DS . 'theme_images' . DS, S2Paths::get('jreviews', 'S2_VIEWS') . 'themes' . DS . 'default' . DS . 'theme_images' . DS);
     $path = fileExistsInPath(array('name' => '', 'suffix' => '', 'ext' => ''), $paths);
     App::import('Helper', array('html', 'routes', 'custom_fields', 'thumbnail'));
     $Html = new HtmlHelper();
     $Routes = new RoutesHelper();
     $CustomFields = new CustomFieldsHelper();
     $Thumbnail = new ThumbnailHelper();
     $Thumbnail->app = 'jreviews';
     $Thumbnail->name = $this->c->name;
     $Thumbnail->action = $this->c->action;
     $Routes->Config = $CustomFields->Config = $Thumbnail->Config = $this->c->Config;
     $Routes->Access = $CustomFields->Access = $Thumbnail->Access = $this->c->Access;
     $Routes->Html = $CustomFields->Html = $Thumbnail->Html = $Html;
     $CustomFields->viewTheme = $Thumbnail->viewTheme =& $this->c->viewTheme;
     $CustomFields->viewSuffix =& $this->c->viewSuffix;
     // Check format of results because we may need to re-format and add fields for Geomaps module
     $first = current($results);
     if (!isset($first['Listing'])) {
         $results = $this->buildListingArray($results, $fields);
     }
     // PaidListings - remove unpaid info
     Configure::read('PaidListings') and PaidListingsComponent::processPaidData($results);
     $marker_icons = array();
     $infowindow_data = array();
     $i = 1;
     $map_counter = 0;
     $default_icon = $this->c->name == 'categories' ? 'numbered' : 'default';
     if (!empty($results)) {
         $infowindow_fields = str_replace(" ", "", Sanitize::getString($this->c->Config, 'geomaps.infowindow_fields'));
         $infowindow_fields = $infowindow_fields != '' ? explode(",", $infowindow_fields) : array();
         foreach ($results as $key => $result) {
             $results[$key] = $this->injectDistanceGroup($result);
             // Override global setting for map display in lists if at least one listing has map enabled
             // For it's listing type and has valid coordinates
             if ($this->c->name == 'categories' && isset($result['ListingType']) && Sanitize::getBool($result['ListingType']['config'], 'geomaps.enable_map_list', true)) {
                 if (isset($result['Geomaps']) && abs($result['Geomaps']['lat']) > 0 && abs($result['Geomaps']['lon']) > 0) {
                     $map_counter++;
                 }
             }
             // Add menu id if not already there
             if (!isset($result['Listing']['menu_id'])) {
                 $results[$key]['Listing']['menu_id'] = $this->c->Menu->getCategory(array('cat_id' => $result['Listing']['cat_id'], 'dir_id' => $result['Directory']['dir_id'], 'section_id' => isset($result['Listing']['section_id']) ? $result['Listing']['section_id'] : null, 'listing' => $result['Listing']['listing_id']));
             }
             $listing_index = ($this->c->page - 1) * $this->c->limit + $i++;
             // Process and add icon info
             $icon = isset($result['Geomaps']) ? json_decode($result['Geomaps']['icon'], true) : array();
             $results[$key]['Geomaps']['icon'] = '';
             $icon_name = $default_icon;
             if (!empty($icon)) {
                 $foundIcon = false;
                 // Check if custom field assigned
                 if ($icon['field'] != '' && substr($icon['field'], 0, 3) == 'jr_') {
                     if (isset($result['Field']['pairs'][$icon['field']]) && isset($result['Field']['pairs'][$icon['field']]['image'][0])) {
                         $icon_name = substr($result['Field']['pairs'][$icon['field']]['image'][0], 0, strpos($result['Field']['pairs'][$icon['field']]['image'][0], '.'));
                         $marker_icons[$icon_name] = $results[$key]['Geomaps']['icon'] = $result['Field']['pairs'][$icon['field']]['image'][0];
                         $foundIcon = true;
                     }
                 } elseif ($icon['cat'] != '' && !$foundIcon) {
                     $icon_name = substr($icon['cat'], 0, strpos($icon['cat'], '.'));
                     if ($icon_name != 'default') {
                         $marker_icons[$icon_name] = $results[$key]['Geomaps']['icon'] = $icon['cat'];
                     }
                 }
             }
             if (isset($result['Geomaps']) && $result['Geomaps']['lat'] != '' && $result['Geomaps']['lon'] != '' && $result['Geomaps']['lat'] != 0 && $result['Geomaps']['lon']) {
                 # Create infowindow JSON object
                 // start with standard fields
                 $infowindow = array('id' => $result['Listing']['listing_id'], 'url' => str_replace(array($www_base, '&amp;'), array('', '&'), $Routes->content('', $results[$key], array('return_url' => true))), 'index' => $listing_index, 'title' => $result['Listing']['title'], 'image' => str_replace($www_base, '', $Thumbnail->thumb($result, 0, array('tn_mode' => $this->c->Config->list_thumb_mode, 'location' => 'list', 'dimensions' => array($this->c->Config->list_image_resize), 'return_src' => 1))), 'featured' => $result['Listing']['featured'], 'rating_scale' => $this->c->Config->rating_scale, 'user_rating' => $result['Review']['user_rating'], 'user_rating_count' => $result['Review']['user_rating_count'], 'editor_rating' => $result['Review']['editor_rating'], 'editor_rating_count' => $result['Review']['editor_rating_count'], 'lat' => (double) $result['Geomaps']['lat'], 'lon' => (double) $result['Geomaps']['lon'], 'icon' => $icon_name);
                 if (!empty($result['Field']['pairs'])) {
                     # Limit fields will included in the payload json object
                     $result['Field']['pairs'] = array_intersect_key($result['Field']['pairs'], array_flip($infowindow_fields));
                     foreach ($result['Field']['pairs'] as $name => $fieldArray) {
                         $infowindow['field'][$name] = $CustomFields->field($name, $result);
                     }
                 }
                 $infowindow_data['id' . $result['Listing']['listing_id']] = $infowindow;
             }
         }
     }
     $this->c->Config->{'geomaps.enable_map_list'} = $map_counter;
     $mapUI = array();
     $zoom = '';
     switch ($this->c->name) {
         case 'categories':
             $maptypes = Sanitize::getString($this->c->Config, 'geomaps.ui.maptype_list', 'buttons');
             //buttons|menu|none
             $maptype_def = Sanitize::getString($this->c->Config, 'geomaps.ui.maptype_def_list', 'G_NORMAL_MAP');
             $map = Sanitize::getBool($this->c->Config, 'geomaps.ui.map_list', 1);
             $hybrid = Sanitize::getBool($this->c->Config, 'geomaps.ui.hybrid_list', 1);
//.........这里部分代码省略.........
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:101,代码来源:geomaps.php


示例5: loadDataSource

 /**
  * Loads the DataSource class for the given connection name
  *
  * @param mixed $connName A string name of the connection, as defined in app/config/database.php,
  *                        or an array containing the filename (without extension) and class name of the object,
  *                        to be found in app/models/datasources/ or cake/libs/model/datasources/.
  * @return boolean True on success, null on failure or false if the class is already loaded
  * @access public
  * @static
  */
 function loadDataSource($connName)
 {
     $_this =& ConnectionManager::getInstance();
     if (is_array($connName)) {
         $conn = $connName;
     } else {
         $connections = $_this->enumConnectionObjects();
         $conn = $connections[$connName];
     }
     if (!empty($conn['parent'])) {
         $_this->loadDataSource($conn['parent']);
     }
     if (class_exists($conn['classname'])) {
         return false;
     }
     if (file_exists(MODELS . 'datasources' . DS . $conn['filename'] . '.php')) {
         require MODELS . 'datasources' . DS . $conn['filename'] . '.php';
     } elseif (fileExistsInPath(LIBS . 'model' . DS . 'datasources' . DS . $conn['filename'] . '.php')) {
         require LIBS . 'model' . DS . 'datasources' . DS . $conn['filename'] . '.php';
     } else {
         $error = __('Unable to load DataSource file %s.php', true);
         trigger_error(sprintf($error, $conn['filename']), E_USER_ERROR);
         return null;
     }
 }
开发者ID:joseluistorres,项目名称:miacupones,代码行数:35,代码来源:connection_manager.php


示例6: __parseFile

 /**
  * Parse file searching for no cache tags
  *
  * @param string $file
  * @param boolean $cache
  * @access private
  */
 function __parseFile($file, $cache)
 {
     if (is_file($file)) {
         $file = file_get_contents($file);
     } elseif ($file = fileExistsInPath($file)) {
         $file = file_get_contents($file);
     }
     preg_match_all('/(<cake:nocache>(?<=<cake:nocache>)[\\s\\S]*?(?=<\\/cake:nocache>)<\\/cake:nocache>)/i', $cache, $oresult, PREG_PATTERN_ORDER);
     preg_match_all('/(?<=<cake:nocache>)([\\s\\S]*?)(?=<\\/cake:nocache>)/i', $file, $result, PREG_PATTERN_ORDER);
     if (!empty($result['0'])) {
         $count = 0;
         foreach ($result['0'] as $result) {
             if (isset($oresult['0'][$count])) {
                 $this->__replace[] = $result;
                 $this->__match[] = $oresult['0'][$count];
             }
             $count++;
         }
     }
 }
开发者ID:carriercomm,项目名称:pastebin-5,代码行数:27,代码来源:cache.php


示例7: _getLayoutFileName

 /**
  * Returns layout filename for this template as a string.
  *
  * @return string Filename for layout file (.thtml).
  * @access protected
  */
 function _getLayoutFileName()
 {
     if (isset($this->webservices) && !is_null($this->webservices)) {
         $type = strtolower($this->webservices) . DS;
     } else {
         $type = null;
     }
     $paths = Configure::getInstance();
     $viewPaths = am($this->pluginPaths, $paths->viewPaths);
     $name = $this->subDir . $type . $this->layout;
     foreach ($viewPaths as $path) {
         if (file_exists($path . 'layouts' . DS . $name . $this->ext)) {
             return $path . 'layouts' . DS . $name . $this->ext;
         } elseif (file_exists($path . 'layouts' . DS . $name . '.ctp')) {
             return $path . 'layouts' . DS . $name . '.ctp';
         }
     }
     if (!is_null($this->pluginPath)) {
         $layoutFileName = APP . $this->pluginPath . 'views' . DS . 'layouts' . DS . $name . $this->ext;
     } else {
         $layoutFileName = VIEWS . 'layouts' . DS . $name . $this->ext;
     }
     $layoutFileName = fileExistsInPath(LIBS . 'view' . DS . 'templates' . DS . 'layouts' . DS . $type . $this->layout . '.thtml');
     if (empty($layoutFileName) && !empty($type)) {
         $layoutFileName = fileExistsInPath(LIBS . 'view' . DS . 'templates' . DS . 'layouts' . DS . $type . 'default.thtml');
     }
     return $layoutFileName;
 }
开发者ID:venka10,项目名称:RUS,代码行数:34,代码来源:view.php


示例8: __parseFile

 /**
  * Parse file searching for no cache tags
  *
  * @param string $file
  * @param boolean $cache
  * @access private
  */
 function __parseFile($file, $cache)
 {
     if (is_file($file)) {
         $file = file_get_contents($file);
     } elseif ($file = fileExistsInPath($file)) {
         $file = file_get_contents($file);
     }
     preg_match_all('/(<cake:nocache>(?<=<cake:nocache>)[\\s\\S]*?(?=<\\/cake:nocache>)<\\/cake:nocache>)/i', $cache, $oresult, PREG_PATTERN_ORDER);
     preg_match_all('/(?<=<cake:nocache>)([\\s\\S]*?)(?=<\\/cake:nocache>)/i', $file, $result, PREG_PATTERN_ORDER);
     if (!empty($this->__replace)) {
         foreach ($oresult['0'] as $k => $element) {
             $index = array_search($element, $this->__match);
             if ($index !== false) {
                 array_splice($oresult[0], $k, 1);
             }
         }
     }
     if (!empty($result['0'])) {
         $count = 0;
         foreach ($result['0'] as $block) {
             if (isset($oresult['0'][$count])) {
                 $this->__replace[] = $block;
                 $this->__match[] = $oresult['0'][$count];
             }
             $count++;
         }
     }
 }
开发者ID:hikmanet,项目名称:HnsAutomobiles,代码行数:35,代码来源:cache.php


示例9: flash

 /**
  * Shows a message to the user $time seconds, then redirects to $url
  * Uses flash.thtml as a layout for the messages
  *
  * @param string $message Message to display to the user
  * @param string $url Relative URL to redirect to after the time expires
  * @param integer $time Time to show the message
  * @access public
  */
 function flash($message, $url, $pause = 1)
 {
     $this->autoRender = false;
     $this->autoLayout = false;
     $this->set('url', Router::url($url));
     $this->set('message', $message);
     $this->set('pause', $pause);
     $this->set('page_title', $message);
     if (file_exists(VIEWS . 'layouts' . DS . 'flash.ctp')) {
         $flash = VIEWS . 'layouts' . DS . 'flash.ctp';
     } elseif (file_exists(VIEWS . 'layouts' . DS . 'flash.thtml')) {
         $flash = VIEWS . 'layouts' . DS . 'flash.thtml';
     } elseif ($flash = fileExistsInPath(LIBS . 'view' . DS . 'templates' . DS . "layouts" . DS . 'flash.ctp')) {
     }
     $this->render(null, false, $flash);
 }
开发者ID:rhencke,项目名称:mozilla-cvs-history,代码行数:25,代码来源:controller.php


示例10: _missingView

 /**
  * Return a misssing view error message
  *
  * @param string $viewFileName the filename that should exist
  * @return cakeError
  */
 function _missingView($viewFileName = null, $action = null)
 {
     if (!is_file($viewFileName) && !fileExistsInPath($viewFileName) || $viewFileName === '/' || $viewFileName === '\\') {
         if (strpos($action, 'missingAction') !== false) {
             $errorAction = 'missingAction';
         } else {
             $errorAction = 'missingView';
         }
         foreach (array($this->name, 'errors') as $viewDir) {
             $errorAction = Inflector::underscore($errorAction);
             if (file_exists(VIEWS . $viewDir . DS . $errorAction . $this->ext)) {
                 $missingViewFileName = VIEWS . $viewDir . DS . $errorAction . $this->ext;
             } elseif (file_exists(VIEWS . $viewDir . DS . $errorAction . '.thtml')) {
                 $missingViewFileName = VIEWS . $viewDir . DS . $errorAction . '.thtml';
             } elseif ($missingViewFileName = fileExistsInPath(LIBS . 'view' . DS . 'templates' . DS . $viewDir . DS . $errorAction . '.ctp')) {
             } else {
                 $missingViewFileName = false;
             }
             $missingViewExists = is_file($missingViewFileName);
             if ($missingViewExists) {
                 break;
             }
         }
         if (strpos($action, 'missingView') === false) {
             return $this->cakeError('missingView', array(array('className' => $this->name, 'action' => $this->action, 'file' => $viewFileName, 'base' => $this->base)));
             exit;
         }
     }
 }
开发者ID:rhencke,项目名称:mozilla-cvs-history,代码行数:35,代码来源:view.php


示例11: flashOut

 /**
  * Replaced with Controller::flash();
  * @deprecated will not be avialable after 1.1.x.x
  */
 function flashOut($message, $url, $pause = 1)
 {
     trigger_error('(Controller::flashOut()) Deprecated: Use Controller::flash() instead', E_USER_WARNING);
     $this->autoRender = false;
     $this->autoLayout = false;
     $this->set('url', $url);
     $this->set('message', $message);
     $this->set('pause', $pause);
     $this->set('page_title', $message);
     if (file_exists(VIEWS . 'layouts' . DS . 'flash.thtml')) {
         $flash = VIEWS . 'layouts' . DS . 'flash.thtml';
     } elseif ($flash = fileExistsInPath(LIBS . 'view' . DS . 'templates' . DS . "layouts" . DS . 'flash.thtml')) {
     }
     $this->render(null, false, $flash);
 }
开发者ID:venka10,项目名称:RUS,代码行数:19,代码来源:controller.php


示例12: makeJsonObject

 /**
  * Creates the json object used for map rendering
  *     
  * @param array $results listings
  * @param mixed $fields  custom fields, required when using the GeoMaps module
  * @param mixed $options mapUI options to override globals when using GeoMaps module
  */
 function makeJsonObject(&$results, &$fields = array(), $options = array())
 {
     $www_base = array_shift(pathinfo(WWW_ROOT));
     // Required for thumbnail path
     $paths = array(S2Paths::get('jreviews', 'S2_VIEWS_OVERRIDES') . 'themes' . DS . $this->c->Config->template . DS . 'theme_images' . DS, S2Paths::get('jreviews', 'S2_VIEWS') . 'themes' . DS . $this->c->Config->template . DS . 'theme_images' . DS, S2Paths::get('jreviews', 'S2_VIEWS_OVERRIDES') . 'themes' . DS . 'default' . DS . 'theme_images' . DS, S2Paths::get('jreviews', 'S2_VIEWS') . 'themes' . DS . 'default' . DS . 'theme_images' . DS);
     $path = fileExistsInPath(array('name' => '', 'suffix' => '', 'ext' => ''), $paths);
     App::import('Helper', array('html', 'routes', 'custom_fields', 'thumbnail'));
     $Html = new HtmlHelper();
     $Routes = new RoutesHelper();
     $CustomFields = new CustomFieldsHelper();
     $Thumbnail = new ThumbnailHelper();
     $Thumbnail->app = 'jreviews';
     $Thumbnail->name = $this->c->name;
     $Thumbnail->action = $this->c->action;
     $Routes->Config = $CustomFields->Config = $Thumbnail->Config = $this->c->Config;
     $Routes->Access = $CustomFields->Access = $Thumbnail->Access = $this->c->Access;
     $Routes->Html = $CustomFields->Html = $Thumbnail->Html = $Html;
     $CustomFields->viewTheme = $Thumbnail->viewTheme =& $this->c->viewTheme;
     $CustomFields->viewSuffix =& $this->c->viewSuffix;
     // Check format of results because we may need to re-format and add fields for Geomaps module
     $first = current($results);
     if (!isset($first['Listing'])) {
         $results = $this->buildListingArray($results, $fields);
     }
     // PaidListings - remove unpaid info
     Configure::read('PaidListings') and PaidListingsComponent::processPaidData($results);
     $marker_icons = array();
     $infowindow_data = array();
     $i = 1;
     $default_icon = $this->c->name == 'categories' ? 'numbered' : 'default';
     // make sure we only have the numeric part of the id from request when checking against listing ids
     $request_id = explode(':', JRequest::getVar('id'));
     $request_id = $request_id[0];
     if (!empty($results)) {
         foreach ($results as $key => $result) {
             $results[$key] = $this->injectDistanceGroup($result);
             // Add menu id if not already there
             if (!isset($result['Listing']['menu_id'])) {
                 $results[$key]['Listing']['menu_id'] = $this->c->Menu->getCategory($result['Listing']['cat_id'], $result['Listing']['section_id'], $result['Directory']['dir_id'], $result['Listing']['listing_id']);
             }
             // Added to support extra coordinates
             //$coords = $result["Field"]["groups"]["Location Info"]["Fields"]["jr_extracoords"]["value"][0];
             //$xtracoords = $CustomFields->field('jr_extracoords', $listing, false, false);
             if (isset($result["Field"]["groups"]["Location Info"]) && isset($result["Field"]["groups"]["Location Info"]["Fields"]["jr_extracoords"])) {
                 $coords = $result["Field"]["groups"]["Location Info"]["Fields"]["jr_extracoords"]["value"][0];
                 if ($coords) {
                     $coords = json_decode($coords);
                     $results[$key]["ExtraCoords"] = $coords;
                     if (JRequest::getString("option") != "com_content") {
                         $results[$key]["ExtraCoords"] = 0;
                     }
                     // HTGMOD
                 }
             } elseif (isset($result["Field"]["pairs"]["jr_extracoords"])) {
                 //detail page
                 $coords = $result["Field"]["pairs"]["jr_extracoords"]["value"][0];
                 if ($coords) {
                     $coords = json_decode($coords);
                     $results[$key]["ExtraCoords"] = $coords;
                     if ($results[$key]["Listing"]["listing_id"] != $request_id) {
                         // "if the current listing_id in the loop == the listing_id being viewed on the detail page...."
                         $results[$key]["ExtraCoords"] = 0;
                     }
                 }
             }
             $listing_index = ($this->c->page - 1) * $this->c->limit + $i++;
             // Process and add icon info
             $icon = isset($result['Geomaps']) ? json_decode($result['Geomaps']['icon'], true) : array();
             $results[$key]['Geomaps']['icon'] = '';
             $icon_name = $default_icon;
             if (!empty($icon)) {
                 $foundIcon = false;
                 // Check if custom field assigned
                 if ($icon['field'] != '' && substr($icon['field'], 0, 3) == 'jr_') {
                     if (isset($result['Field']['pairs'][$icon['field']]) && isset($result['Field']['pairs'][$icon['field']]['image'][0])) {
                         $icon_name = substr($result['Field']['pairs'][$icon['field']]['image'][0], 0, strpos($result['Field']['pairs'][$icon['field']]['image'][0], '.'));
                         $marker_icons[$icon_name] = $results[$key]['Geomaps']['icon'] = $result['Field']['pairs'][$icon['field']]['image'][0];
                         $foundIcon = true;
                     }
                 } elseif ($icon['cat'] != '' && !$foundIcon) {
                     $icon_name = substr($icon['cat'], 0, strpos($icon['cat'], '.'));
                     if ($icon_name != 'default') {
                         $marker_icons[$icon_name] = $results[$key]['Geomaps']['icon'] = $icon['cat'];
                     }
                 }
             }
             if (isset($result['Geomaps']) && $result['Geomaps']['lat'] != '' && $result['Geomaps']['lon'] != '' && $result['Geomaps']['lat'] != 0 && $result['Geomaps']['lon']) {
                 # Create infowindow JSON object
                 // start with standard fields
                 $infowindow = array('id' => $result['Listing']['listing_id'], 'url' => str_replace(array($www_base, '&amp;'), array('', '&'), $Routes->content('', $results[$key], array('return_url' => true))), 'index' => $listing_index, 'title' => $result['Listing']['title'], 'image' => str_replace($www_base, '', $Thumbnail->thumb($result, 0, 'scale', 'list', array($this->c->Config->list_image_resize), array('return_src' => 1))), 'featured' => $result['Listing']['featured'], 'rating_scale' => $this->c->Config->rating_scale, 'user_rating' => $result['Review']['user_rating'], 'user_rating_count' => $result['Review']['user_rating_count'], 'editor_rating' => $result['Review']['editor_rating'], 'editor_rating_count' => $result['Review']['editor_rating_count'], 'lat' => (double) $result['Geomaps']['lat'], 'lon' => (double) $result['Geomaps']['lon'], 'icon' => $icon_name);
                 // Added for Hooked
                 $infowindow['criteria_id'] = $result['Criteria']['criteria_id'];
                 if (isset($results[$key]["ExtraCoords"])) {
//.........这里部分代码省略.........
开发者ID:bizanto,项目名称:Hooked,代码行数:101,代码来源:geomaps.php


示例13: loadBehavior

/**
 * Loads a behavior
 *
 * @param string $name Name of behavior
 * @return boolean Success
 */
function loadBehavior($name)
{
    if ($name === null) {
        return true;
    }
    if (strpos($name, '.') !== false) {
        list($plugin, $name) = explode('.', $name);
    }
    $paths = Configure::getInstance();
    if (!class_exists($name . 'Behavior')) {
        $name = Inflector::underscore($name);
        foreach ($paths->behaviorPaths as $path) {
            if (file_exists($path . $name . '.php')) {
                require $path . $name . '.php';
                return true;
            }
        }
        if ($behavior_fn = fileExistsInPath(LIBS . 'model' . DS . 'behaviors' . DS . $name . '.php')) {
            if (file_exists($behavior_fn)) {
                require $behavior_fn;
                return true;
            } else {
                return false;
            }
        }
    }
    return true;
}
开发者ID:rhencke,项目名称:mozilla-cvs-history,代码行数:34,代码来源:basics.php


示例14: afterRecord

 /**
  *	Se ejecuta por cada reorganizar los datos de un registro
  *	resultado de una búsqueda.
  *
  *	@param array &$record Una referencia a un arreglo con los datos del registro.
  *	@param bool $primary Indica si se realizó la búsqueda directamente en
  *		este modelo o de lo contrario por medio de una relación. El valor
  *		por omisión es false.
  *	@return array Registro reorganizado.
  *	@access public
  */
 function afterRecord(&$record, $primary = false)
 {
     if (empty($record['mime'])) {
         return;
     }
     $path = sprintf('/%s/%s_%s/%s', Configure::read("Media.dir"), $record['model'], $record['foreign_key'], $record['alias']);
     $filename = sprintf('%s-%s.%s', Inflector::slug($record['name'], '-'), $record['id'], $record['extension']);
     $record['url'] = sprintf('%s/%s', $path, $filename);
     $record['temp'] = Inflector::slug($record['name'], '-') . '-' . $record['id'];
     if ($image = $this->isImage($record['mime'])) {
         $record['thumb'] = sprintf('%s/~%s', $path, $filename);
         $settings = Configure::read("{$this->name}.{$record['model']}.{$record['alias']}");
         if (!empty($settings['copies'])) {
             foreach ($settings['copies'] as $folder => $copy) {
                 $record[$folder] = sprintf('%s/%s/%s', $path, $folder, $filename);
                 if ($fullpath = fileExistsInPath($record[$folder])) {
                     $file =& new File($fullpath);
                     $record[$folder . '$'] = $file->path;
                 } else {
                     $record[$folder] = sprintf('/img/no-pic-%s-%s.jpg', $copy['width'], $copy['height']);
                 }
             }
         }
         if ($fullpath = fileExistsInPath($record['thumb'])) {
             $file =& new File($fullpath);
             $record['thumb$'] = $file->path;
         } else {
             $record['thumb'] = '/img/no-pic-100-100.jpg';
         }
     } else {
         $record['thumb'] = $this->icon($record['extension']);
         $record['temp'] = Inflector::slug($record['name'], '-') . '-' . $record['id'];
     }
     if ($fullpath = fileExistsInPath($record['url'])) {
         $file =& new File($fullpath);
         $record['$'] = $file->path;
     } elseif ($image) {
         $record['url'] = $settings['resize'] ? sprintf('/img/no-pic-%s-%s.jpg', $settings['width'], $settings['height']) : '/img/no-pic.jpg';
     }
 }
开发者ID:roae,项目名称:hello-world,代码行数:51,代码来源:medium.php


示例15: _parseFile

 /**
  * Parse file searching for no cache tags
  *
  * @param string $file The filename that needs to be parsed.
  * @param string $cache The cached content
  * @return void
  */
 protected function _parseFile($file, $cache)
 {
     if (is_file($file)) {
         $file = file_get_contents($file);
     } elseif ($file = fileExistsInPath($file)) {
         $file = file_get_contents($file);
     }
     preg_match_all('/(<!--nocache:\\d{3}-->(?<=<!--nocache:\\d{3}-->)[\\s\\S]*?(?=<!--\\/nocache-->)<!--\\/nocache-->)/i', $cache, $outputResult, PREG_PATTERN_ORDER);
     preg_match_all('/(?<=<!--nocache-->)([\\s\\S]*?)(?=<!--\\/nocache-->)/i', $file, $fileResult, PREG_PATTERN_ORDER);
     $fileResult = $fileResult[0];
     $outputResult = $outputResult[0];
     if (!empty($this->_replace)) {
         foreach ($outputResult as $i => $element) {
             $index = array_search($element, $this->_match);
             if ($index !== false) {
                 unset($outputResult[$i]);
             }
         }
         $outputResult = array_values($outputResult);
     }
     if (!empty($fileResult)) {
         $i = 0;
         foreach ($fileResult as $cacheBlock) {
             if (isset($outputResult[$i])) {
                 $this->_replace[] = $cacheBlock;
                 $this->_match[] = $outputResult[$i];
             }
             $i++;
         }
     }
 }
开发者ID:pushpendraraj,项目名称:tigzie,代码行数:38,代码来源:CacheHelper.php


示例16: _getViewFileName

 function _getViewFileName($action)
 {
     $action = Inflector::underscore($action);
     $paths = Configure::getInstance();
     $type = null;
     if (empty($action)) {
         $action = $this->action;
     }
     $position = strpos($action, '..');
     if ($position === false) {
     } else {
         $action = explode('/', $action);
         $i = array_search('..', $action);
         unset($action[$i - 1]);
         unset($action[$i]);
         $action = '..' . DS . implode(DS, $action);
     }
     foreach ($paths->viewPaths as $path) {
         if (file_exists($path . $this->viewPath . DS . $this->subDir . $type . $action . $this->ext)) {
             $viewFileName = $path . $this->viewPath . DS . $this->subDir . $type . $action . $this->ext;
             return $viewFileName;
         }
     }
     // added for .ctp viewPath fallback
     foreach ($paths->viewPaths as $path) {
         if (file_exists($path . $this->viewPath . DS . $type . $action . '.ctp')) {
             $viewFileName = $path . $this->viewPath . DS . $type . $action . '.ctp';
             return $viewFileName;
         }
     }
     if ($viewFileName = fileExistsInPath(LIBS . 'view' . DS . 'templates' . DS . 'errors' . DS . $type . $action . '.ctp')) {
     } elseif ($viewFileName = fileExistsInPath(LIBS . 'view' . DS . 'templates' . DS . $this->viewPath . DS . $type . $action . '.ctp')) {
     } else {
         $viewFileName = VIEWS . $this->viewPath . DS . $this->subDir . $type . $action . $this->ext;
     }
     return $viewFileName;
 }
开发者ID:BGCX262,项目名称:ztrackerengine-svn-to-git,代码行数:37,代码来源:smarty.php


示例17: testFileExistsInPath

 /**
  * test fileExistsInPath()
  *
  * @access public
  * @return void
  */
 function testFileExistsInPath()
 {
     $this->skipUnless(function_exists('ini_set'), '%s ini_set function not available');
     $_includePath = ini_get('include_path');
     $path = TMP . 'basics_test';
     $folder1 = $path . DS . 'folder1';
     $folder2 = $path . DS . 'folder2';
     $file1 = $path . DS . 'file1.php';
     $file2 = $folder1 . DS . 'file2.php';
     $file3 = $folder1 . DS . 'file3.php';
     $file4 = $folder2 . DS . 'file4.php';
     new Folder($path, true);
     new Folder($folder1, true);
     new Folder($folder2, true);
     touch($file1);
     touch($file2);
     touch($file3);
     touch($file4);
     ini_set('include_path', $path . PATH_SEPARATOR . $folder1);
     $this->assertEqual(fileExistsInPath('file1.php'), $file1);
     $this->assertEqual(fileExistsInPath('file2.php'), $file2);
     $this->assertEqual(fileExistsInPath('folder1' . DS . 'file2.php'), $file2);
     $this->assertEqual(fileExistsInPath($file2), $file2);
     $this->assertEqual(fileExistsInPath('file3.php'), $file3);
     $this->assertEqual(fileExistsInPath($file4), $file4);
     $this->assertFalse(fileExistsInPath('file1'));
     $this->assertFalse(fileExistsInPath('file4.php'));
     $Folder = new Folder($path);
     $Folder->delete();
     ini_set('include_path', $_includePath);
 }
开发者ID:surfingtonio,项目名称:flashub.com,代码行数:37,代码来源:basics.test.php


示例18: renderAs

 /**
  * Sets the layout and template paths for the content type defined by $type.
  *
  * @param object $controller A reference to a controller object
  * @param string $type Type of response to send (e.g: 'ajax')
  * @access public
  * @see RequestHandlerComponent::setContent()
  * @see RequestHandlerComponent::respondAs()
  */
 function renderAs(&$controller, $type)
 {
     if ($type == 'ajax') {
         $controller->layout = $this->ajaxLayout;
         return $this->respondAs('html', array('charset' => 'UTF-8'));
     }
     $controller->ext = '.ctp';
     if (empty($this->__renderType)) {
         $controller->viewPath .= '/' . $type;
     } else {
         $controller->viewPath = preg_replace("/\\/{$type}\$/", '/' . $type, $controller->viewPath);
     }
     $this->__renderType = $type;
     $controller->layoutPath = $type;
     if (in_array($type, array_keys($this->__requestContent))) {
         $this->respondAs($type);
     }
     if (!in_array(ucfirst($type), $controller->helpers)) {
         if (file_exists(HELPERS . $type . '.php') || fileExistsInPath(LIBS . 'view' . DS . 'helpers' . DS . $type . '.php')) {
             $controller->helpers[] = ucfirst($type);
         }
     }
 }
开发者ID:rhencke,项目名称:mozilla-cvs-history,代码行数:32,代码来源:request_handler.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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