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


PHP initialize函数代码示例

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


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

示例1: initialize

 function initialize($name, $url)
 {
     global $wgTmpDirectory;
     $local_file = tempnam($wgTmpDirectory, 'WEBUPLOAD');
     $this - initialize($name, $local_file, 0, true);
     $this->mUrl = trim($url);
 }
开发者ID:amjadtbssm,项目名称:website,代码行数:7,代码来源:UploadFromUrl.php

示例2: run

function run()
{
    initialize();
    $fh = fopen('php://output', 'w');
    $rows = CRM_Upgrade_Incremental_php_FourTwo::deleteInvalidPairs();
    if (!empty($rows)) {
        echo "The following records have been processed. If action = Un-linked, that membership has been disconnected from the contribution record.\n";
        echo "Contact ID, ContributionID, Contribution Status, MembershipID, Membership Type, Start Date, End Date, Membership Status, Action \n";
    } else {
        echo "Could not find any records to process.\n";
    }
    foreach ($rows as $row) {
        fputcsv($fh, $row);
    }
}
开发者ID:kidaa30,项目名称:yes,代码行数:15,代码来源:cleanup42.php

示例3: query_the_swear

function query_the_swear()
{
    wp_reset_postdata();
    $options = initialize();
    if ($options['max_password_length'] != null) {
        $max = intval($options['max_password_length']);
    } else {
        $max = 18;
    }
    if ($options['number_digits'] != null) {
        $num = intval($options['number_digits']);
    } else {
        $num = 999;
    }
    if ($options['posts_per_page'] != null) {
        $int = intval($options['posts_per_page']);
    } else {
        $int = -1;
    }
    $post_type = 'vulgar-term';
    $end = "";
    $count = 0;
    $i = 0;
    $args = array('post_type' => $post_type, 'posts_per_page' => $int, 'orderby' => 'rand');
    // echo ($int);
    $loop = new WP_Query($args);
    //var_dump($loop);
    while ($end_loop != true && $loop->have_posts()) {
        $loop->the_post();
        //echo the_title();
        $str = get_the_title();
        $term_str = clean_term_string($str, $count);
        $final_str .= $term_str;
        if (strlen($final_str) >= $max) {
            //$final_str .= $term_str;
            $end_loop = true;
        }
        $num = rand(0, $num);
        //echo $count ;
        $count += 1;
    }
    $id = save_term_string($final_str);
    //save_vulgar_password( $final_str );
    return $final_str . $num;
    wp_reset_postdata();
}
开发者ID:amgxyz,项目名称:vulgar-password,代码行数:46,代码来源:vulgar-password.php

示例4: done_testing

function done_testing()
{
    global $t;
    $funcs = get_defined_functions();
    $initialize = false;
    $finalize = false;
    if (in_array('initialize', $funcs['user'])) {
        $initialize = true;
    }
    if (in_array('finalize', $funcs['user'])) {
        $finalize = true;
    }
    if (in_array('build', $funcs['user'])) {
        build($t);
    }
    foreach ($funcs['user'] as $func) {
        # 予約された function
        if (in_array($func, array('build', 'destroy', 'initialize', 'finalize', 'done_testing'))) {
            continue;
        }
        # _function( ) は skip
        if (preg_match('/^_/', $func)) {
            continue;
        }
        if ($initialize) {
            initialize($t);
        }
        try {
            $t->diag("in function '{$func}'");
            $func($t);
        } catch (Exception $e) {
            $t->diag($e->getMessage() . " at {$func}( )");
            $t->fail();
        }
        if ($finalize) {
            finalize($t);
        }
    }
    if (in_array('destroy', $funcs['user'])) {
        destroy($t);
    }
}
开发者ID:hatyuki,项目名称:php-ClassTrigger,代码行数:42,代码来源:setup.php

示例5: IsAuthenticated

function IsAuthenticated()
{
    if (!session_id()) {
        session_start();
    }
    $dbConnection = initialize();
    $query = $dbConnection->prepare("SELECT `password` " . "FROM `user_info` " . "WHERE `user_id` = ? " . "AND `user_name` = ? " . "AND `type` = ?");
    if ($query && !$query->errno) {
        $query->bind_param("iss", $_SESSION['user_id'], $_SESSION['username'], $_SESSION['type']);
        if ($query->execute()) {
            $result = $query->get_result()->fetch_assoc();
            if (!empty($result) && !empty($result['password'])) {
                $loginString = hash('sha512', $result['password'] . $_SERVER['HTTP_USER_AGENT']);
                if ($_SESSION['login_string'] == $loginString) {
                    return true;
                }
            }
        }
    }
    return false;
}
开发者ID:nimashoghi,项目名称:LolStatBot,代码行数:21,代码来源:auth.php

示例6: dirname

<?php

/**
 *  該程式僅供於 training 環境使用
 *      - 不使用 web hook
 *      - 資料直接取得 https://api.telegram.org/bot???:??????/getUpdates
 *
 */
$basePath = dirname(__DIR__);
require_once $basePath . '/app/bootstrap.php';
initialize($basePath, 'home');
if (!isTraining()) {
    echo ErrorSupportHelper::getJson('4002');
    exit;
}
$telegram = BotHelper::getTelegram();
try {
    $updates = $telegram->getUpdates();
} catch (\Telegram\Bot\Exceptions\TelegramResponseException $e) {
    put($e->getMessage());
    return;
}
$result = [];
$messages = new Messages();
foreach ($updates as $update) {
    $message = MessageHelper::makeMessageByTelegramUpdate($update);
    // 從 updates 來的資料會有許多重覆資料
    // 該確認之後再寫入
    $existMessage = $messages->getMessageByMessageId($message->getMessageId());
    if ($existMessage) {
        continue;
开发者ID:glennfriend,项目名称:tg-bot,代码行数:31,代码来源:telegram-bot-update.php

示例7: error_reporting

<?php

error_reporting(E_ALL);
setlocale(LC_ALL, 'de_DE');
session_start();
include 'includes/config.php';
include 'library/default/functions/autoload.php';
include 'library/default/functions/initialize.php';
$microtimeFloatStart = microtime(true);
$database = new library_default_classes_database();
$database->connect();
$GLOBALS['user'] = application_frontend_user_controller::getUser();
if (isset($_GET['app']) && !empty($_GET['app'])) {
    $object = initialize($_GET['app']);
    $object->actionController();
} else {
    $object = new application_frontend_index_controller();
    $object->actionController();
}
$microtimeFloat = microtime(true) - $microtimeFloatStart;
//mysql_query("insert into _loadtime (uid, app, referer, ip, browser, microtime, created) values ('".$GLOBALS['user']['myuid']."', '".$_SERVER['REQUEST_URI']."', '".$_SERVER['HTTP_REFERER']."', '".$_SERVER['REMOTE_ADDR']."', '".$_SERVER['HTTP_USER_AGENT']."', '".$microtimeFloat."', now())");
开发者ID:Tungse,项目名称:croncase,代码行数:21,代码来源:index.php

示例8: initialize

<?php

/**
 * Created by PhpStorm.
 * User: Nima
 * Date: 7/26/2015
 * Time: 3:08 PM
 */
include_once '../inc/mysqlConn.php';
if (isset($_POST['id']) && isset($_POST['hidden'])) {
    $dbName = '`team_information`';
    if (isset($_POST['type']) && $_POST['type'] == 'player') {
        $dbName = '`player_information`';
    }
    $dbConnection = initialize();
    $query = $dbConnection->prepare("UPDATE {$dbName} " . "SET `hidden` = ? " . "WHERE `id` = ?");
    if ($query && !$query->errno) {
        $query->bind_param('ii', $_POST['hidden'], $_POST['id']);
        if ($query->execute() && $query->affected_rows > 0) {
            die("1");
        }
    }
}
die("0");
开发者ID:nimashoghi,项目名称:LolStatBot,代码行数:24,代码来源:hidden_submit.php

示例9: main

function main()
{
    date_default_timezone_set('Americas/New_York');
    $shortopts = "i:j:p:w:";
    // Required value
    $longopts = array("industry:", "jobs:", "prospects:", "wages:");
    // initialize
    initialize();
    $options = getopt($shortopts, $longopts);
    $industries = loadTSV($options['industry'], 0, "SocCode");
    $jobs = loadTSV($options['jobs'], 0, "SocCode", ["JobTitle", ""]);
    $prospects = loadTSV($options['prospects'], 1, "SocCode");
    $wages = loadTSV($options['wages'], 1, "SocCode", ["JobTitle", ""]);
    cleanupWages($wages);
    $master = array_merge_recursive($jobs, $prospects, $wages);
    array_walk($master, function (&$item, $key) {
        if (is_array($item)) {
            array_walk($item, function (&$item, $key) {
                if (is_array($item)) {
                    $item = array_unique($item);
                }
            });
        }
    });
    usort($master, function ($a, $b) {
        if ($a == $b) {
            return 0;
        }
        return $a < $b ? -1 : 1;
    });
    calcJobScores($master);
    $industries = createDbQueries($industries, "industry");
    $jobs = createDbQueries($master, "jobs");
    executeQueries(array_merge($industries, $jobs));
}
开发者ID:menace690,项目名称:Blue-Economics,代码行数:35,代码来源:data_loader.php

示例10: initialize

                                $stdout = $case_element->addChild('stdout', PHP_EOL . $line . PHP_EOL);
                            } else {
                                $existing = (string) $stdout[0];
                                $case_element->stdout = $existing . $line . PHP_EOL;
                            }
                        }
                    }
                }
            }
        }
    }
    // write it out again
    $xml->asXML($log_name);
}
if (in_array("--new", $argv)) {
    initialize($installed);
    exit;
}
if (in_array("--reset", $argv)) {
    reinitialize($installed);
    exit;
}
require_once 'conf/saunter.inc';
$GLOBALS['settings']['saunter.base'] = getcwd();
$timestamp = date('Y-m-d-h-i-s');
$GLOBALS['settings']['logdir'] = $GLOBALS['settings']['saunter.base'] . DIRECTORY_SEPARATOR . 'logs' . DIRECTORY_SEPARATOR . $timestamp;
mkdir($GLOBALS['settings']['logdir']);
$GLOBALS['settings']['logname'] = $GLOBALS['settings']['logdir'] . DIRECTORY_SEPARATOR . $timestamp . '.xml';
array_push($_SERVER['argv'], "--log-junit");
array_push($_SERVER['argv'], $GLOBALS['settings']['logname']);
array_push($_SERVER['argv'], "scripts");
开发者ID:PurdyForks,项目名称:saunter.php,代码行数:31,代码来源:saunter.php

示例11: time

 in case of of failure the action is repeated up to "$repeat" times;
 OAI errors will be reported and the execution of the script is aborted.

 Example:
 php ./oai_harvest.php http://gdz.sub.uni-goettingen.de/oai2/ ListRecords ./gdzNeu/ metadataPrefix=mets set=mathematica  from=2011-05-10
 Example for a call using an Internet browser:
 http://gdz.sub.uni-goettingen.de/oai2/?verb=GetRecord&metadataPrefix=oai_dc&identifier=gdz.sub.uni-goettingen.de:PPN623147521

 Note: Some of the calls, in particular ListRecords, may need a broadband internet connection and
 still may take a long time (up to hours) and collect large amounts of data (Gigabytes!).
 So beware and be patient, watch the output to observe if the call does what you want!
 Note: The files are downloaded as <verb>.xml and then copied to another name with tags on separate lines.
 In particular, the last file is always present as <verb>.xml and in an edited version.
 If this is undesirable then comment the line: file_put_contents($targetdir.$theVerb.'.xml',$data);
*/
list($arrArgs, $arrArgs2, $targetdir, $sets, $theExtension, $testmode) = initialize($defaultDir, $testFile);
$errorlog = $targetdir . 'error.log';
$harvestlog = $targetdir . 'harvest.log';
$theBaseUrl = $arrArgs['oaiURL'];
$theVerb = $arrArgs['verb'];
if (!$testmode) {
    $theBaseUrl .= '?verb=' . $theVerb;
}
if (!($errorHandle = fopen($errorlog, 'a'))) {
    echo $errorlog . ' is not writeable!' . "\n";
    exit;
}
if (!($logHandle = fopen($harvestlog, 'a'))) {
    echo $harvestlog . ' is not writeable!' . "\n";
    exit;
}
开发者ID:horaciod,项目名称:oai_harvest,代码行数:31,代码来源:oai_harvest.php

示例12: shell_exec

    $json = shell_exec("fedmsg-config");
    $config = json_decode($json, true);
    /* Just make sure everything is sane with the fedmsg config */
    if (!array_key_exists('relay_inbound', $config)) {
        echo "fedmsg-config has no 'relay_inbound'";
        return false;
    }
    $context = new ZMQContext(1, true);
    $queue = $context->getSocket(ZMQ::SOCKET_PUB, "pub-a-dub-dub");
    $queue->connect($config['relay_inbound']);
    return true;
}
# If we can successfully initialize a zmq socket, then we'll go ahead and
# register our hooks with mediawiki.  If we fail for some reason, we don't want
# mediawiki calling us, so we'll fail quietly.
if (initialize()) {
    $wgHooks['ArticleSaveComplete'][] = 'article_save';
    $wgHooks['UploadComplete'][] = 'upload_complete';
}
# This is a reimplementation of the python code in fedmsg/crypto.py
# That file is authoritative.  Changes there should be reflected here.
function sign_message($message_obj)
{
    global $config;
    $message = json_encode($message_obj);
    # Step 0) - Find our cert.
    $fqdn = gethostname();
    $tokens = explode('.', $fqdn);
    $hostname = $tokens[0];
    $ssldir = $config['ssldir'];
    $certname = $config['certnames']['mediawiki.' . $hostname];
开发者ID:relrod,项目名称:fedmsg,代码行数:31,代码来源:fedmsg-emit.php

示例13: run

/**
 * Running application
 *
 * @param string $env 
 * @return void
 */
function run($env = null)
{
    if (is_null($env)) {
        $env = env();
    }
    # 0. Set default configuration
    $root_dir = dirname(app_file());
    $lim_dir = dirname(__FILE__);
    $base_path = dirname(file_path($env['SERVER']['SCRIPT_NAME']));
    $base_file = basename($env['SERVER']['SCRIPT_NAME']);
    $base_uri = file_path($base_path, $base_file == 'index.php' ? '?' : $base_file . '?');
    option('root_dir', $root_dir);
    //option('limonade_dir',       file_path($lim_dir));
    //option('limonade_views_dir', file_path($lim_dir, 'limonade', 'views'));
    //option('limonade_public_dir',file_path($lim_dir, 'limonade', 'public'));
    option('public_dir', file_path($root_dir, 'public'));
    option('views_dir', file_path($root_dir, 'views'));
    option('controllers_dir', file_path($root_dir, 'controllers'));
    option('lib_dir', file_path($root_dir, 'lib'));
    //option('error_views_dir',    option('limonade_views_dir'));
    //option('base_path',          $base_path);
    option('base_uri', $base_uri);
    // set it manually if you use url_rewriting
    //  option('env',                ENV_PRODUCTION);
    option('debug', true);
    //option('session',            LIM_SESSION_NAME); // true, false or the name of your session
    option('encoding', 'utf-8');
    //option('signature',          LIM_NAME); // X-Limonade header value or false to hide it
    option('gzip', false);
    option('x-sendfile', 0);
    // 0: disabled,
    // X-SENDFILE: for Apache and Lighttpd v. >= 1.5,
    // X-LIGHTTPD-SEND-FILE: for Apache and Lighttpd v. < 1.5
    # 1. Set handlers
    # 1.1 Set error handling
    #ifndef KittenPHP
    ini_set('display_errors', 1);
    #endif
    //set_error_handler('error_handler_dispatcher', E_ALL ^ E_NOTICE);
    # 1.2 Register shutdown function
    register_shutdown_function('stop_and_exit');
    # 2. Set user configuration
    if (!function_exists('configure')) {
        function configure()
        {
        }
    }
    configure();
    # 2.1 Set gzip compression if defined
    if (is_bool(option('gzip')) && option('gzip')) {
        ini_set('zlib.output_compression', '1');
    }
    # 2.2 Set X-Limonade header
    //if($signature = option('signature')) send_header("X-Limonade: $signature");
    # 3. Loading libs
    //fallbacks_for_not_implemented_functions();
    # 4. Starting session
    //if(!defined('SID') && option('session'))
    //  {
    //    if(!is_bool(option('session'))) session_name(option('session'));
    //    if(!session_start()) trigger_error("An error occured while trying to start the session", E_USER_WARNING);
    //  }
    # 5. Set some default methods if needed
    if (!function_exists('route_missing')) {
        function route_missing($request_method, $request_uri)
        {
            halt(NOT_FOUND, "({$request_method}) {$request_uri}");
        }
    }
    if (!function_exists('initialize')) {
        function initialize()
        {
        }
    }
    initialize();
    # 6. Check request
    if ($rm = request_method($env)) {
        if (request_is_head($env)) {
            ob_start();
        }
        // then no output
        if (!request_method_is_allowed($rm)) {
            halt(HTTP_NOT_IMPLEMENTED, "The requested method <code>'{$rm}'</code> is not implemented");
        }
        # 6.1 Check matching route
        if ($route = route_find($rm, request_uri($env))) {
            params($route['params']);
            # 6.3 Call before function
            if (!function_exists('before')) {
                function before($route)
                {
                }
            }
            before($route);
//.........这里部分代码省略.........
开发者ID:enikesha,项目名称:v_order,代码行数:101,代码来源:k_limonade.php

示例14: ini_set

 */
ini_set('default_charset', 'utf-8');
require_once "Utility.class.inc";
require_once "NDB_Config.class.inc";
require_once "MincEnv.php.inc";
$headers = array();
$query = "select File from files where FileID = :MincID";
$minc_file = $DB->pselectOne($query, array('MincID' => $_REQUEST['minc_id']));
$minc_file = getMincLocation() . $minc_file;
$header = $_REQUEST['minc_headers'];
$header_data = $_REQUEST['raw_data'];
if ($header_data) {
    passthru("minctoraw -double -normalize {$minc_file}");
}
if ($header == 'true' && $minc_file != null) {
    print initialize($minc_file);
}
/**
 * Extracts the values required for a specific dimension from a minc file
 *
 * @param string $dimension A string representing the dimension to extract
 * @param string $minc_file The filename to run mincinfo on to extract
 *                          information
 *
 * @return array with elements start, space_length, and step populated
 */
function extractDimension($dimension, $minc_file)
{
    return array('start' => exec("mincinfo -attval {$dimension}:start {$minc_file}"), 'space_length' => exec("mincinfo -dimlength {$dimension} {$minc_file}"), 'step' => exec("mincinfo -attval {$dimension}:step {$minc_file}"), 'dir_cosines' => explode(" ", exec("mincinfo -attval {$dimension}:direction_cosines {$minc_file}")));
}
/**
开发者ID:spaiva,项目名称:Loris,代码行数:31,代码来源:minc.php

示例15: header

<?php

header('Content-Type: text/html; charset=UTF-8');
ini_set('date.timezone', 'UTC');
include_once 'inc/auth.php';
CheckAuthentication();
require_once 'inc/utils.php';
require_once 'inc/mysqlConn.php';
require_once 'inc/relativeTime.php';
$dbConn = initialize();
function revString($s)
{
    if ($s == '1') {
        return '0';
    }
    return '1';
}
?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8"" http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <link rel="icon" href="favicon.ico">

    <title>LoL Statbot - Dashboard</title>

    <!-- Bootstrap core CSS -->
    <link href="css/bootstrap.min.css" rel="stylesheet">
开发者ID:nimashoghi,项目名称:LolStatBot,代码行数:31,代码来源:searchPlayers.php


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