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


PHP find函数代码示例

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


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

示例1: isNewBrowscapVersion

function isNewBrowscapVersion()
{
    if (!isset($_SESSION['user_browscap_version'])) {
        $_SESSION['user_browscap_version'] = getCurrentBrowscapRelease();
    }
    if (!isset($_SESSION['server_browscap_version'])) {
        $server_browscap_version = "";
        if (extension_loaded('soap')) {
            $http = new Http();
            $http->setTimeout(2);
            $http->execute("http://www.website-php.com/en/webservices/wsp-information-server.wsdl?wsdl");
            $wsdl = $http->getResult();
            if ($wsdl != "" && find($wsdl, "<?xml", 1) > 0) {
                $client = new WebSitePhpSoapClient("http://www.website-php.com/en/webservices/wsp-information-server.wsdl?wsdl");
                $server_browscap_version = $client->getBrowscapVersionNumber();
            }
        } else {
            /*$http = new Http();
            		$http->setTimeout(2);
            		$http->execute("http://browsers.garykeith.com/versions/version-number.asp");
            		$server_browscap_version = $http->getResult();*/
            $server_browscap_version = "";
        }
        if (trim($server_browscap_version) != "") {
            $_SESSION['server_browscap_version'] = $server_browscap_version;
        }
    }
    if (trim($_SESSION['user_browscap_version']) != trim($_SESSION['server_browscap_version'])) {
        return trim($_SESSION['server_browscap_version']);
    }
    return false;
}
开发者ID:kxopa,项目名称:WebSite-PHP,代码行数:32,代码来源:utils-version.inc.php

示例2: renice

function renice($pid, $app)
{
    $root = 0;
    $salida = null;
    $root = comp();
    $process = find($pid, $app);
    if ($process != null) {
        $put = $app->request();
        $ni = $put->put('ni');
        if (is_numeric($ni)) {
            if ((int) $ni > -21 && (int) $ni < 20) {
                if ($root == 1) {
                    $par = "sudo ./renice.sh norberfaraz@gmail.com " . $ni . " " . $pid;
                } else {
                    $par = "renice " . $ni . " " . $pid;
                }
                $salida = shell_exec($par);
                if ($salida == null) {
                    $salida = "No tiene permisos para repriorizar el proceso con ID:" . $pid;
                    $app->render(202, array('msg' => $salida, 'error' => 'true'));
                } else {
                    $app->render(200, array('msg' => $salida, 'error' => 'false'));
                }
            } else {
                $app->render(202, array('msg' => 'la variable ni(prioridad) no esta bien definida, debe ser un valor numerico entre 20 y -20 2 ', 'error' => 'true'));
            }
        } else {
            $app->render(202, array('msg' => 'la variable ni(prioridad) no esta bien definida, debe ser un valor numerico entre 20 y -20  1 ' . $ni . 'h', 'error' => 'true'));
        }
    } else {
        $app->render(202, array('msg' => 'Proceso inexistente', 'error' => true));
    }
}
开发者ID:norberfaraz,项目名称:api-rest,代码行数:33,代码来源:renice.php

示例3: add

 function add()
 {
     if (!in_array($this->_get_param('type'), array('IssueCustomField', 'UserCustomField', 'ProjectCustomField', 'TimeEntryCustomField'))) {
         $this->redirect('index');
     }
     $this->CustomField->bindModel(array('hasMany' => array('CustomFieldsTracker')), false);
     $custom_field = array($this->CustomField->name => array('type' => $this->_get_param('type')));
     if (!empty($this->request->data)) {
         $this->CustomField->set($this->request->data);
         if ($this->CustomField->save()) {
             $event = new CakeEvent('Controller.Candy.customFieldsNewAfterSave', $this, array('custom_field' => $this->request->data));
             $this->getEventManager()->dispatch($event);
             $this->Session->setFlash(__('Successful update.'), 'default', array('class' => 'flash flash_notice'));
             $this->redirect(array('action' => 'index', '?' => array('tab' => $this->_get_param('type'))));
         }
     } else {
         $this->request->data = $custom_field;
     }
     if ($this->_get_param('type') == "IssueCustomField" && $this->_get_param('tracker_ids')) {
         $custom_field['Tracker'] = $this->CustomFieldsTracker->Tracker . find('list', array('conditions' => array('id' => $this->_get_param('tracker_ids'))));
     }
     $Tracker = ClassRegistry::init('Tracker');
     $this->set('trackers', $Tracker->find('list', array('order' => 'position')));
     $this->set('custom_field', $custom_field);
     $this->render("new");
 }
开发者ID:ha1t,项目名称:candycane,代码行数:26,代码来源:CustomFieldsController.php

示例4: find

/**
 * 查找指定目录下的文件或目录
 * @static
 * @param string $path 目录路径
 * @param null $include 要包含的文件正则,如果设置了,则只有符合这个正则的文件才能被请求到
 * @param null $exclude  要排除的文件正则,如果设置了,即使是包含的文件,也会被排除
 * @param bool $recursion 是否递归查找,默认是true
 * @param bool $include_dir 找到的结果是否包含目录,默认为false,不包含
 * @param array $files 递归用的存储容器,不应该被用到
 * @return array 数组
 */
function find($path, $include = null, $exclude = null, $recursion = true, $include_dir = false, &$files = array())
{
    // $path = self::realpath($path);
    if (is_dir($path)) {
        $path .= '/';
        $dir = dir($path);
        while (false !== ($entry = $dir->read())) {
            if ($entry == '.' || $entry == '..' || $entry[0] == '.' && is_dir($path . $entry)) {
                continue;
            }
            $entry = $path . $entry;
            if (is_dir($entry)) {
                if ($include_dir && filter($entry, $include, $exclude)) {
                    $files[] = $entry;
                }
                if ($recursion) {
                    find($entry, $include, $exclude, true, $include_dir, $files);
                }
            } else {
                if (!filter($entry, $include, $exclude)) {
                    continue;
                }
                $files[] = $entry;
            }
        }
        $dir->close();
        return $files;
    } else {
        if (is_file($path) && filter($path, $include, $exclude)) {
            $files[] = $path;
        }
    }
    return $files;
}
开发者ID:jinglf000,项目名称:cs,代码行数:45,代码来源:list.php

示例5: run

 public function run()
 {
     $this->req('id');
     $this->req('link_god');
     if ($id && ($user = find("\\System\\User", $id))) {
         $heading = $locales->trans('godmode_user_edit_passwd');
         $f = $ren->form(array("id" => 'edit_user_groups', "heading" => $heading));
         $f->input_password('password', $locales->trans('godmode_user_password'), true);
         $f->input_password('password_check', $locales->trans('godmode_user_password_check'), true);
         $f->submit($locales->trans('godmode_save'));
         if ($f->passed()) {
             $p = $f->get_data();
             if ($p['password'] === $p['password_check']) {
                 $p['password'] = hash_passwd($p['password']);
                 $user->update_attrs($p)->save();
                 $flow->redirect(\Godmode\Router::url($request, $link_god, 'detail', array($user->id)));
             } else {
                 $f->out($this);
             }
         } else {
             $f->out($this);
         }
     } else {
         throw new System\Error\NotFound();
     }
 }
开发者ID:just-paja,项目名称:fudjan-godmode,代码行数:26,代码来源:edit_passwd.php

示例6: login

 public function login()
 {
     $this->layout = 'sesion';
     //Registro de asistencia
     if ($this->request->is('post')) {
         $cedula = $this->request->data['Personal']['cedula'];
         if (!empty($cedula)) {
             $this->request->data['usuario'] = "argemen";
             $this->request->data['clave'] = "argenis";
             $usuario = $this->Usuario->validateLogin($this->request->data);
             if ($usuario) {
                 App::import('Model', 'Personal');
                 $personal = new Personal();
                 $this->set('cedula', $personal_ > find('all', array('conditions' => array('cedula' => $cedula))));
                 //$this->render('login','ajax');
             }
         } else {
             if (!empty($this->request->data)) {
                 if (($usuario = $this->Usuario->validateLogin($this->request->data)) == true) {
                     $this->Session->write('usuario', $usuario);
                     //$this->Session->setFlash('You\'ve successfully logged in.');
                     $this->redirect(array('action' => 'inicio'));
                     exit;
                 } else {
                     $this->Session->setFlash('Usuario Invalido!!', 'default', array('class' => 'error'));
                     $this->redirect(array('action' => 'login'));
                 }
             }
         }
     }
     //Fin verificación método post
 }
开发者ID:rsuarez2012,项目名称:bioasistmr,代码行数:32,代码来源:UsuariosController.php

示例7: __construct

 function __construct($page_object, $array_menu)
 {
     parent::__construct();
     $this->render = new Menu();
     $wsp_admin_url = WSP_ADMIN_URL;
     $menu_items = new MenuItems();
     foreach ($array_menu['MenuItems']['MenuItem'] as $menuitems) {
         eval("\$page_icon_16 = \"" . $menuitems['Menu_attr']['icon_16'] . "\";");
         if (find($menuitems['Menu_attr']['name'], "__(", 0, 0) > 0) {
             eval("\$page_title = " . $menuitems['Menu_attr']['name'] . ";");
         } else {
             eval("\$page_title = \"" . $menuitems['Menu_attr']['name'] . "\";");
         }
         eval("\$page_link = \"" . $menuitems['Menu_attr']['url'] . "\";");
         if ($menuitems['Menu_attr']['url'] == "\$wsp_admin_url/admin.html") {
             $page_title = "";
         }
         $menu_item = new MenuItem($page_title, $page_link, $page_icon_16);
         if (isset($_GET['menu'])) {
             if ($page_link == $wsp_admin_url . "/admin.html?menu=" . $_GET['menu']) {
                 $menu_item->setCurrent();
             }
         }
         $menu_items->add($menu_item);
         $sub_menu_items = new MenuItems();
         if (!isset($menuitems['MenuItems']['MenuItem'][0])) {
             $sub_menuitems = $menuitems['MenuItems'];
         } else {
             $sub_menuitems = $menuitems['MenuItems']['MenuItem'];
         }
         $nb_sub_menu = 0;
         foreach ($sub_menuitems as $menuitem) {
             eval("\$page_icon_16 = \"" . $menuitem['Menu_attr']['icon_16'] . "\";");
             if (find($menuitem['Menu_attr']['name'], "__(", 0, 0) > 0) {
                 eval("\$page_title = " . $menuitem['Menu_attr']['name'] . ";");
             } else {
                 eval("\$page_title = \"" . $menuitem['Menu_attr']['name'] . "\";");
             }
             eval("\$page_link = \"" . $menuitem['Menu_attr']['url'] . "\";");
             $sub_menu_item = new MenuItem($page_title, $page_link, $page_icon_16);
             if ($page_link == $_GET['p'] . ".html") {
                 $sub_menu_item->setCurrent();
                 $menu_item->setCurrent();
             }
             $sub_menu_items->add($sub_menu_item);
             $nb_sub_menu++;
         }
         if ($nb_sub_menu > 0) {
             $menu_item->setMenuItems($sub_menu_items);
         }
     }
     $this->render->setMenuItems($menu_items);
     $this->render->activateSupersubs();
     list($strAdminLogin, $strAdminPasswd, $strAdminRights) = getWspUserRightsInfo("admin");
     if ($strAdminLogin == "admin" && $strAdminPasswd == sha1("admin")) {
         $modalbox = new DialogBox(__(CHANGE_PASSWD), new Url($page_object->getBaseLanguageURL() . "wsp-admin/change-passwd.call"));
         $modalbox->modal()->setWidth(400);
         $page_object->addObject($modalbox);
     }
 }
开发者ID:kxopa,项目名称:WebSite-PHP,代码行数:60,代码来源:admin-menu.inc.php

示例8: dictionary

function dictionary($words)
{
    if ($words) {
        switch ($words) {
            case 'apple':
                find($words, '蘋果');
                break;
            case 'orange':
                find($words, '橘子');
                break;
            case 'watermelon':
                find($words, '西瓜');
                break;
            case 'strawberry':
                find($words, '草莓');
                break;
            case 'pineapple':
                find($words, '鳳梨');
                break;
            default:
                echo "水果字典中沒有" . $words . "這個單字";
                break;
        }
    }
}
开发者ID:jinfu8898,项目名称:php254,代码行数:25,代码来源:hw3.php

示例9: __construct

 /**
  * Constructor JavaScript
  * @param string $code_javascript 
  * @param boolean $add_js_to_page [default value: false]
  */
 function __construct($code_javascript, $add_js_to_page = false)
 {
     parent::__construct();
     if (!isset($code_javascript)) {
         throw new NewException("1 argument for " . get_class($this) . "::__construct() is mandatory", 0, getDebugBacktrace(1));
     }
     $this->code_javascript = $code_javascript;
     $this->is_javascript_object = true;
     if ($add_js_to_page) {
         $page_object = Page::getInstance($_GET['p']);
         if (gettype($code_javascript) != "object") {
             // search in javascript if begin by $(document).ready(
             // then put javascript to the end (for AJAX because doc is already loaded)
             $tmp_code_javascript = trim(str_replace("\t", "", $code_javascript));
             $pos_doc_ready = find($tmp_code_javascript, "\$(document).ready(", 1);
             $pos_jquery_ready = find($tmp_code_javascript, "jQuery(document).ready(", 1);
             if ($pos_doc_ready >= 18 && $pos_doc_ready <= 30 || $pos_jquery_ready >= 23 && $pos_jquery_ready <= 35) {
                 // 30|35: beacause of tag //<![CDATA[
                 $page_object->addObject($this, false, true);
             } else {
                 $page_object->addObject($this);
             }
         } else {
             $page_object->addObject($this);
         }
     }
 }
开发者ID:kxopa,项目名称:WebSite-PHP,代码行数:32,代码来源:JavaScript.class.php

示例10: __construct

 /**
  * Constructor File
  * @param mixed $filename path to the file
  * @param boolean $binary [default value: false]
  * @param boolean $delete_if_exists [default value: false]
  * @param boolean $debug [default value: true]
  */
 function __construct($filename, $binary = false, $delete_if_exists = false, $debug = true)
 {
     $this->debug = $debug;
     $filename = str_replace("\\", "/", $filename);
     $this->name = $filename;
     $this->binary = $binary;
     if (file_exists($filename)) {
         $this->exists = true;
     } else {
         if (find($filename, "http://") == 0 && find($filename, "https://") == 0 && find($filename, "ftp://") == 0) {
             // we don't create a directory if it's a web file
             if (!is_dir(substr(0, strrpos($filename, "/"), $filename))) {
                 $create_folder = "";
                 $tmp_filename = $filename;
                 if (ini_get('open_basedir') != "") {
                     $open_basedir_array = explode(":", ini_get('open_basedir'));
                     for ($i = 0; $i < sizeof($open_basedir_array); $i++) {
                         if (trim($open_basedir_array[$i]) != "" && substr($filename, 0, strlen($open_basedir_array[$i])) == $open_basedir_array[$i]) {
                             $create_folder = $open_basedir_array[$i];
                             if ($create_folder[strlen($create_folder) - 1] != "/") {
                                 $create_folder .= "/";
                             }
                             $tmp_filename = substr($filename, strlen($create_folder));
                             break;
                         }
                     }
                 }
                 $array_dir = explode("/", $tmp_filename);
                 for ($i = 0; $i < sizeof($array_dir) - 1; $i++) {
                     $create_folder_before = $create_folder;
                     $create_folder .= $array_dir[$i] . "/";
                     if (!file_exists($dir) && !is_dir($create_folder) && $create_folder != "/") {
                         if (!mkdir($create_folder)) {
                             if (!mkdir(realpath($create_folder_before) . "/" . $array_dir[$i] . "/")) {
                                 $this->halt("Can't create folder " . $create_folder . ".");
                             }
                         }
                     }
                 }
             }
         }
     }
     if ($delete_if_exists && $this->exists) {
         if (!unlink($filename)) {
             $this->halt("Can't delete exists file " . $filename . ".");
         }
     }
     if ($binary) {
         $this->file = @fopen($filename, "a+b");
         if (!$this->file) {
             $this->file = @fopen($filename, "rb");
         }
     } else {
         $this->file = @fopen($filename, "a+");
         if (!$this->file) {
             $this->file = @fopen($filename, "r");
         }
     }
 }
开发者ID:kxopa,项目名称:WebSite-PHP,代码行数:66,代码来源:File.class.php

示例11: index

 function index()
 {
     $this->pagedata['statusId'] = $this->system->getConf('shopex.wss.enable');
     if (!IN_AJAX) {
         $lang = $_GET['_lang'] ? $_GET['_lang'] : $this->op->get('lang');
         $lang = $lang ? $lang : 'zh_CN';
         $setting = array('lang' => $lang);
         foreach ($_GET as $k => $v) {
             if (substr($k, 0, 1) == '_' && strlen($k) > 1) {
                 $setting[substr($k, 1)] = $v;
             }
         }
         $this->op->load();
         if (defined('SAAS_MODE') && SAAS_MODE) {
             $this->pagedata['saas_mode'] = true;
             $saas = $this->system->loadModel('service/saas');
             if ($shopinfo = $saas->native_svc('host.getinfo', array('host_id' => HOST_ID))) {
                 if ($shopinfo['response_code'] > 0) {
                     $this->pagedata['shop_service_info'] = $shopinfo['response_error'];
                 } else {
                     $this->pagedata['shop_service_info'] .= $shopinfo['service_name'];
                     $this->pagedata['shop_service_info'] .= $shopinfo['status'] == 'tryout' ? '(试用)' : '';
                     $this->pagedata['shop_service_info'] .= '[' . date('y/m/d', $shopinfo['add_time']) . '-' . date('y/m/d', $shopinfo['finish_time']) . ']';
                 }
             }
         }
         $titlename = $this->system->getConf('system.shopname');
         $this->pagedata['title'] = $titlename . ' - Powered By ShopEx';
         $this->pagedata['shopname'] = empty($titlename) ? "点此设置商店名称" : $titlename;
         $this->pagedata['session_id'] = $this->system->session->sess_id;
         $this->pagedata['shopadmin_dir'] = dirname($_SERVER['PHP_SELF']) . '/';
         $this->pagedata['shop_base'] = $this->system->base_url();
         $this->pagedata['setting_query'] = http_build_query($setting) . '&_lang=' . $lang;
         $this->pagedata['uname'] = $this->op->name ? $this->op->name : $this->op->loginName;
         include_once 'adminSchema.php';
         $this->pagedata['menu'] = $this->op->getMenu(null, $this->op->is_super);
         $this->_fetchM($this->pagedata['menu'], $menus, array());
         $menus = array_values($menus);
         foreach ($menus as $i => $m) {
             foreach ($menus[$i]['key'] as $k => $v) {
                 $mkey[] = array($k, $i);
             }
             unset($menus[$i]['key']);
         }
         $i = count($menus);
         foreach ($mlist as $k => $v) {
             $menus[$i] = $v;
             $mkey[] = array($k, $i);
             $i++;
         }
         $this->pagedata['guide'] = $this->system->getConf('system.guide');
         $this->pagedata['scripts'] = find(dirname($_SERVER['SCRIPT_FILENAME']) . '/js', 'js');
         $this->pagedata['mlist'] = array('menus' => &$menus, 'key' => &$mkey);
         $this->setView('index.html');
         $this->output();
     } else {
         $this->system->error(401);
     }
 }
开发者ID:dalinhuang,项目名称:shopexts,代码行数:59,代码来源:ctl.default.php

示例12: autoload

/**
 * Autoload
 *
 * @param   $class  Class name.
 * @return  boolean
 */
function autoload($class)
{
    $filename = str_replace('_', DS, $class);
    if ($path = find($filename . EXT)) {
        include $path;
        return TRUE;
    }
    return FALSE;
}
开发者ID:romartyn,项目名称:cogear,代码行数:15,代码来源:index.php

示例13: index

 function index()
 {
     $this->pagedata['statusId'] = $this->system->getConf('shopex.wss.enable');
     if (!IN_AJAX) {
         foreach ($_GET as $k => $v) {
             if (substr($k, 0, 1) == '_' && strlen($k) > 1) {
                 $setting[substr($k, 1)] = $v;
             }
         }
         if (constant('SAAS_MODE')) {
             $saas =& $this->system->loadModel('service/saas');
             if ($shopinfo = $saas->native_svc('host.getinfo', array('host_id' => HOST_ID))) {
                 if ($shopinfo['response_code'] > 0) {
                     $this->pagedata['shop_service_info'] = $shopinfo['response_error'];
                 } else {
                     $this->pagedata['shop_service_info'] .= $shopinfo['service_name'];
                     $this->pagedata['shop_service_info'] .= $shopinfo['status'] == 'tryout' ? __('(试用)') : '';
                     $this->pagedata['shop_service_info'] .= '[' . date('y/m/d', $shopinfo['add_time']) . '-' . date('y/m/d', $shopinfo['finish_time']) . ']';
                 }
             }
         }
         $titlename = $this->system->getConf('system.shopname');
         $this->pagedata['title'] = $titlename . ' - Powered By ShopEx';
         $this->pagedata['shopname'] = empty($titlename) ? __("点此设置商店名称") : $titlename;
         $this->pagedata['session_id'] = $this->system->sess_id;
         $this->pagedata['status_url'] = urlencode(PHP_SELF . '?ctl=default&act=status&sess_id=' . $this->system->sess_id);
         $this->pagedata['shopadmin_dir'] = '/' . SHOPADMIN_PATH . '/';
         $this->pagedata['shop_base'] = $this->system->base_url();
         $this->pagedata['uname'] = $this->system->op_name;
         $this->pagedata['shop_type_info'] = '1to1' == $this->system->getConf('system.b2c_shop_type') ? '批零店' : '加盟连锁店';
         if (!function_exists('admin_menu_filter')) {
             require CORE_INCLUDE_DIR . '/shop/admin.menu_filter.php';
         }
         $this->pagedata['menu'] =& admin_menu_filter($this->system, null);
         $this->_fetchM($this->pagedata['menu'], $menus, array());
         $menus = array_values($menus);
         foreach ($menus as $i => $m) {
             foreach ($menus[$i]['key'] as $k => $v) {
                 $mkey[] = array($k, $i);
             }
             unset($menus[$i]['key']);
         }
         $i = count($menus);
         foreach ($mlist as $k => $v) {
             $menus[$i] = $v;
             $mkey[] = array($k, $i);
             $i++;
         }
         $this->pagedata['guide'] = $this->system->getConf('system.guide');
         $this->pagedata['scripts'] = find(dirname($_SERVER['SCRIPT_FILENAME']) . '/js_src', 'js');
         $this->pagedata['mlist'] = array('menus' => &$menus, 'key' => &$mkey);
         $this->display('index.html');
     } else {
         $this->system->error(401);
     }
 }
开发者ID:noikiy,项目名称:cxe,代码行数:56,代码来源:ctl.default.php

示例14: approve

 public function approve($id)
 {
     return $this->db->query("UPDATE users SET user_level = ? WHERE id = ?", array(4, $id));
     $user = find($id);
     $to = $user['email'];
     $password = $user['password'];
     $subject = "Welcome to LINK! Your membership has been approved!";
     $message = "Congratulations! You are now officially a Rescue Team Member. You can login with your email. Your temporrary password is {$password}. Please change it when you first log into your account.";
     mail($to, $subject, $message);
 }
开发者ID:vtt01uk,项目名称:link,代码行数:10,代码来源:user.php

示例15: getLocalPath

 /**
  * Method getLocalPath
  * @access public
  * @return string
  * @since 1.0.35
  */
 public function getLocalPath()
 {
     $path = $this->getPath();
     if ($this->treeview_object == null) {
         $this->treeview_object = $this->getTreeViewObject();
     }
     if ($this->treeview_object->isRootFolder()) {
         $path = substr($path, find($path, "/", 0, 0), strlen($path));
     }
     return str_replace("\\", "/", $this->treeview_object->getLoadedPath() . $path);
 }
开发者ID:kxopa,项目名称:WebSite-PHP,代码行数:17,代码来源:TreeViewFolder.class.php


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