Esempio n. 1
0
 public function __construct(&$CMSContent)
 {
     // $this->CMSContent = &$CMSContent;
     $helloWorld = new HelloWorld($CMSContent);
     $this->response['result'] = true;
     $this->response['output'] = $helloWorld->createHelloWorld();
 }
Esempio n. 2
0
 public function testWhat()
 {
     $helloWorld = new HelloWorld($this->pdo);
     $this->assertFalse($helloWorld->what());
     $helloWorld->hello('Bar');
     $this->assertEquals('Bar', $helloWorld->what());
 }
Esempio n. 3
0
 /**
  * @group Slow
  * @slowExecutionTime 0.05355 ms
  */
 public function testGettingWikiData()
 {
     $testRow = new stdClass();
     $testRow->city_title = self::TEST_TITLE;
     $testRow->city_url = self::TEST_URL;
     $dbMock = $this->getMock('DatabaseMysql', array('selectRow'));
     $dbMock->expects($this->once())->method('selectRow')->will($this->returnValue($testRow));
     $this->mockGlobalVariable('wgExternalSharedDB', '');
     $this->mockGlobalFunction('wfGetDB', $dbMock);
     $object = new HelloWorld();
     $result = $object->getWikiData(self::TEST_WIKI_ID);
     $this->assertEquals(self::TEST_TITLE, $result['title']);
     $this->assertEquals(self::TEST_URL, $result['url']);
 }
Esempio n. 4
0
 /**
  * 显示登录页(默认Action)
  */
 function doDefault()
 {
     /* {{{ 调试用例开始 */
     $data = array('a' => 'a', 'b' => 3);
     $this->debug('数据库连接失败');
     $this->debug($data);
     $this->debug('提示信息');
     $this->debug('警告信息');
     $this->debug('错误信息');
     echo '调试方法使用,通过firephp和friebug查看相关调试信息<br />';
     /* }}} */
     $page = $this->app->page();
     /* {{{ 输出验证码链接 */
     echo '<img src="?do=code" ><br />';
     /* }}} */
     /* {{{ 验证验证码 */
     if ($_GET['code']) {
         echo '验证码检测结果:' . var_export($this->_checkCode(trim($_GET['code'])), true) . '<br />';
     }
     /* }}} */
     /* {{{ 导出基础类 */
     import('util.Ip');
     //include('util/Ip.class.php');
     echo Ip::get() . '<br />';
     //调用IP类中获取IP的方法
     /* }}} */
     /* {{{ 导出应用定义模块文件 */
     importModule('HelloWorld');
     //include('modules/HelloWorld.class.php');
     echo HelloWorld::Test('HelloWorld::Test') . '<br />';
     //调用IP类中获取IP的方法
     /* }}} */
     /* {{{ 获取IP地址 */
     echo 'Application 获得的IP地址' . $this->app->ip() . '<br />';
     /* }}} */
     /* {{{页面跳转 */
     if ($_GET['go'] == 'redirect') {
         $this->app->redirect('http://www.baidu.com/');
     }
     /* }}} */
     /* {{{ 测试smarty页面输出 */
     $page->value('title', '这是页面变量!!');
     $page->output();
     /* }}} */
 }
Esempio n. 5
0
<?php

namespace Hello\World;

$objHelloWorld = new HelloWorld("Oscar");
$objHelloWorld->say();
$objShowHelloWorld = new ShowHelloWorld($objHelloWorld->getNombre());
$objShowHelloWorld->epale();
Esempio n. 6
0
 public function testSayHello()
 {
     $hw = new HelloWorld();
     $string = $hw->sayHello();
     $this->assertEquals('Hello World!', $string);
 }
Esempio n. 7
0
<?php

/**
 * Autoload provided by Composer
 */
require_once realpath(__DIR__ . '/vendor/autoload.php');
/**
 * Example Classes
 */
include realpath(__DIR__ . '/HelloWorldClasses.php');
// Use facade as Alias
$aliases = ["HelloWorld" => "HelloWorldFacade"];
// Create aliases
foreach ($aliases as $alias => $abstract) {
    class_alias($abstract, $alias);
}
/**
 * How to use a Facade Class?
 */
// Use normal methods
HelloWorld::hello();
// You can pass arguments too.
HelloWorld::hello("John Doe");
Esempio n. 8
0
 public function testSayHello()
 {
     $hello = new HelloWorld();
     $this->assertEquals("Hello World!", $hello->sayHello());
 }
<?php

include_once '../lib/client/facebook.php';
include_once '../lib/AppConfig.class.php';
include_once '../lib/HelloWorld.class.php';
$facebook = new Facebook(AppConfig::$api_key, AppConfig::$secret);
$app = new HelloWorld($facebook);
$user = $facebook->require_login();
$app->goodbye($user);
<?php

include_once '../lib/client/facebook.php';
include_once '../lib/AppConfig.class.php';
include_once '../lib/HelloWorld.class.php';
$facebook = new Facebook(AppConfig::$api_key, AppConfig::$secret);
$facebook->require_frame();
$user = $facebook->require_login();
$facebook->require_add();
$app = new HelloWorld($facebook);
if ($_GET['ids']) {
    foreach ($_GET['ids'] as $key) {
        $app->record_invite($user, $key);
    }
}
$exclude_ids = $facebook->api_client->friends_getAppUsers();
$sent_invites = $app->get_invites($user);
$exclude_ids = array_merge($exclude_ids, $sent_invites);
$referralTracker = urlencode("?referralbyuser="******"{$user}" firstnameonly="true" shownetwork="false"/> wants you to add {$app_name} to receive greetings from <fb:pronoun objective="true" possessive="false" uid="{$user}"/>.
<fb:req-choice url="http://www.facebook.com/add.php?api_key={$app_key}&next={$referralTracker}" label="Add {$app_name}" />
FBML;
?>
<fb:request-form type="<?php 
echo AppConfig::$app_name;
?>
" action="invite.php" content="<?php 
echo htmlentities($invite_fbml);
Esempio n. 11
0
<?php

$hello = new HelloWorld();
$hello->hello();
$hello->create_tab();
/**  This is my first file */
class HelloWorld
{
    function __construct()
    {
    }
    function create_tab()
    {
    }
    function hello()
    {
        die(__METHOD__);
        // something is bad here.
    }
    /**
     * Create account for corvin.
     * @param type $username
     */
    function create_account($username = "******")
    {
        echo "created account for {$username}";
    }
    /**
     * Related to issue MFP-8 Administration console.
     */
    function create_console()
<?php

include_once '../lib/client/facebook.php';
include_once '../lib/AppConfig.class.php';
include_once '../lib/HelloWorld.class.php';
// Create a new Facebook client object
$facebook = new Facebook(AppConfig::$api_key, AppConfig::$secret);
// Prevent this page from being viewed outside the context of app.facebook.com/appname/
$facebook->require_frame();
// Prevent this page from being viewed without a valid logged in user
// -- NOTE: This does not mean that the logged in user has added the application
$user = $facebook->require_login();
// Require the viewing user to have added the application.
$facebook->require_add();
$app = new HelloWorld($facebook);
// Get the greetings to and from this user
$greetings_from = $app->get_greetings('user_from', $user, 5);
$greetings_to = $app->get_greetings('user_to', $user, 5);
$greetings_from_count = $app->get_greeting_count('user_from', $user);
$greetings_to_count = $app->get_greeting_count('user_to', $user);
?>
<fb:dashboard>
<fb:action href="/nghelloworld/">View My Greetings</fb:action>
<fb:action href="/nghelloworld/wave.php">Send a greeting</fb:action>
</fb:dashboard>

<div style="padding: 10px;">
  <h2>Hello <fb:name firstnameonly="true" uid="<?php 
echo $user;
?>
" useyou="false"/>!</h2>
Esempio n. 13
0
 /**
  * 显示登录页(默认Action)
  */
 function doDefault()
 {
     /* {{{ 调试用例开始 */
     $data = array('a' => 'a', 'b' => 3);
     $this->debug('数据库连接失败');
     $this->debug($data);
     $this->debug('提示信息');
     $this->debug('警告信息');
     $this->debug('错误信息');
     echo '调试方法使用,通过firephp和friebug查看相关调试信息<br />';
     /* }}} */
     $page = $this->app->page();
     /* {{{ 分页字符串生成 */
     $page_cur = $_GET['page'] ? intval($_GET['page']) : 0;
     $data = $page->getNav(40, 7, $page_cur, '<a href="?page=%d">%d</a>&nbsp;&nbsp;', '<b>%d</b>');
     echo '分页处理:' . $data . '<br />';
     /* }}} */
     /* {{{ 输出验证码链接 */
     echo '<img src="?do=code" ><br />';
     /* }}} */
     /* {{{ 验证验证码 */
     if ($_GET['code']) {
         echo '验证码检测结果:' . var_export($this->_checkCode(trim($_GET['code'])), true) . '<br />';
     }
     /* }}} */
     /* {{{ 导出基础类 */
     import('util.Ip');
     //include('util/Ip.class.php');
     echo Ip::get() . '<br />';
     //调用IP类中获取IP的方法
     /* }}} */
     /* {{{ 导出应用定义模块文件 */
     importModule('HelloWorld');
     //include('modules/HelloWorld.class.php');
     echo HelloWorld::Test('HelloWorld::Test') . '<br />';
     //调用IP类中获取IP的方法
     /* }}} */
     /* {{{ 获取IP地址 */
     echo 'Application 获得的IP地址' . $this->app->ip() . '<br />';
     /* }}} */
     /* {{{页面跳转 */
     if ($_GET['go'] == 'redirect') {
         $this->app->redirect('http://www.baidu.com/');
     }
     /* }}} */
     /* {{{ 测试smarty页面输出 */
     $page->value('title', '这是页面变量!');
     $page->output();
     /* }}} */
     /** {{{ 通过SOCKET执行SOAP请求 **/
     /*  SOCKET INPUT DATA
     		POST /HRWeb/Asmx/Reming.asmx HTTP/1.1
     		Host: 192.168.2.36
     		Content-Type: text/xml; charset=utf-8
     		Content-Length: length
     		SOAPAction: "http://tempuri.org/PersonnelInfo"
     		
     		<?xml version="1.0" encoding="utf-8"?>
     		<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
     		  <soap:Body>
     		    <PersonnelInfo xmlns="http://tempuri.org/">
     		      <p_lUserId>int</p_lUserId>
     		    </PersonnelInfo>
     		  </soap:Body>
     		</soap:Envelope>		
     		*/
     /*  SOCKET OUTPUT DATA
     		HTTP/1.1 200 OK
     		Content-Type: text/xml; charset=utf-8
     		Content-Length: length
     		
     		<?xml version="1.0" encoding="utf-8"?>
     		<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
     		  <soap:Body>
     		    <PersonnelInfoResponse xmlns="http://tempuri.org/">
     		      <PersonnelInfoResult>
     		        <UserId>int</UserId>
     		        <UserName>string</UserName>
     		        <UserPhotolink>string</UserPhotolink>
     		        <UserAge>int</UserAge>
     		        <UserSex>string</UserSex>
     		        <UserNative>string</UserNative>
     		        <UserParty>string</UserParty>
     		        <UserNation>string</UserNation>
     		        <UserBirthday>dateTime</UserBirthday>
     		        <UserHeight>string</UserHeight>
     		        <UserBlood>string</UserBlood>
     		        <UserCardCode>string</UserCardCode>
     		        <UserMarriage>string</UserMarriage>
     		        <UserMobile>string</UserMobile>
     		        <UserPhone>string</UserPhone>
     		        <UserEmail>string</UserEmail>
     		        <UserHJAdd>string</UserHJAdd>
     		        <UserXZAdd>string</UserXZAdd>
     		        <UserHKArea>string</UserHKArea>
     		        <UserDAArea>string</UserDAArea>
     		        <UserBYSchool>string</UserBYSchool>
     		        <DepCode>string</DepCode>
     		        <DepName>string</DepName>
     		        <GWName>string</GWName>
     		        <ZWName>string</ZWName>
     		        <ZCName>string</ZCName>
     		        <UserType>string</UserType>
     		        <WorkAge>int</WorkAge>
     		        <GraNum>string</GraNum>
     		        <JoinDate>dateTime</JoinDate>
     		        <SYDate>dateTime</SYDate>
     		      </PersonnelInfoResult>
     		    </PersonnelInfoResponse>
     		  </soap:Body>
     		</soap:Envelope>		
     		*/
     $args = array('p_lUserId' => '100418');
     echo '<p>_soap action:<br />';
     //var_dump($this->_soap('192.168.2.36', 'HRWeb/Asmx/Reming.asmx', 'PersonnelInfo', $args));
     echo '</p>';
     /* }}} */
 }
<?php

include_once '../lib/client/facebook.php';
include_once '../lib/AppConfig.class.php';
include_once '../lib/HelloWorld.class.php';
// Create a new Facebook client object
$facebook = new Facebook(AppConfig::$api_key, AppConfig::$secret);
// Prevent this page from being viewed outside the context of app.facebook.com/appname/
$facebook->require_frame();
// Prevent this page from being viewed without a valid logged in user
// -- NOTE: This does not mean that the logged in user has added the application
$user = $facebook->require_login();
// Require the viewing user to have added the application.
$facebook->require_add();
$app = new HelloWorld($facebook);
$app->first_time($user);
if ($_GET['referralbyuser']) {
    $app->save_referral($user, $_GET['referralbyuser']);
}
?>
<fb:dashboard>
<fb:action href="/nghelloworld/">View My Greetings</fb:action>
<fb:action href="/nghelloworld/wave.php">Send a greeting</fb:action>
</fb:dashboard>

<div style="padding: 10px;">
  <h2>Hello <fb:name firstnameonly="true" uid="<?php 
echo $user;
?>
" useyou="false"/>!</h2>
  <p>Welcome to this application!</p>
 public function handle(HelloWorld $command)
 {
     echo $command->getMessage();
 }
<?php

include_once '../lib/client/facebook.php';
include_once '../lib/AppConfig.class.php';
include_once '../lib/HelloWorld.class.php';
// Create a new Facebook client object
$facebook = new Facebook(AppConfig::$api_key, AppConfig::$secret);
// Prevent this page from being viewed outside the context of app.facebook.com/appname/
$facebook->require_frame();
// Prevent this page from being viewed without a valid logged in user
// -- NOTE: This does not mean that the logged in user has added the application
$user = $facebook->require_login();
// Require the viewing user to have added the application.
$facebook->require_add();
$app = new HelloWorld($facebook);
// Create a var to represent the target user, default it to null
$target_user = null;
if (isset($_POST['friend_sel'])) {
    // If the friend_sel var is set in the POST vars, typecast it to an
    // integer and set the target_user
    $target_user = (int) $_POST['friend_sel'];
}
// By default we show the form, and the action_wave and wave_success are
// set to false.
$wave_success = false;
$action_wave = false;
$show_form = true;
if ($target_user) {
    $action_wave = true;
    $show_form = false;
    // The target_user is set, send them a greeting
<?php

namespace Scrutinizer\Docs;

class HelloWorld
{
    function hello($x)
    {
        print "Hello, {$x}";
    }
}
$c = new HelloWorld();
$c->hello("world");
<?php

include_once '../lib/client/facebook.php';
include_once '../lib/AppConfig.class.php';
include_once '../lib/HelloWorld.class.php';
$facebook = new Facebook(AppConfig::$api_key, AppConfig::$secret);
$app = new HelloWorld($facebook);
$user = 0;
if (isset($_GET['user'])) {
    $user = (int) $_GET['user'];
}
$greetings_from = $app->get_greetings('user_from', $user);
$gfromcount = count($greetings_from);
$greetings_to = $app->get_greetings('user_to', $user);
$gtocount = count($greetings_to);
$tomessage = '';
$frommessage = '';
if ($gtocount) {
    $tomessage = "<p><fb:name uid=\"profileowner\" firstnameonly=\"true\" useyou=\"false\" /> has been waved to {$gtocount} times.</p>";
} else {
    $tomessage = "<p>No one has waved hello to <fb:name uid=\"profileowner\" firstnameonly=\"true\" useyou=\"false\" />!</p>";
}
if ($gfromcount) {
    $frommessage = "<p><fb:name uid=\"profileowner\" firstnameonly=\"true\" useyou=\"false\" /> has waved hello to {$gfromcount} people.</p>";
} else {
    $frommessage = "<p><fb:name uid=\"profileowner\" firstnameonly=\"true\" useyou=\"false\" /> has not waved to anyone.</p>";
}
?>
<fb:wide>
<?php 
echo $frommessage;
Esempio n. 19
0
<?php

require __DIR__ . "/../vendor/autoload.php";
class HelloWorld extends RubbishThorClone
{
    public function commands()
    {
        $this->command('hello NAME', 'say hello to NAME', function ($option_parser) {
            $option_parser->addHead("Says hello to a person.\n");
            $option_parser->addRule('b::', "Congratulates NAME on their bigness");
        });
    }
    public function hello($name)
    {
        echo "Hi, {$name}!\n";
        if (isset($this->options->big)) {
            echo "Aren't you a big fella?\n";
        }
    }
}
$hello = new HelloWorld();
$hello->start($argv);
Esempio n. 20
0
        return $this->foo;
    }
}
// create a corresponding node and add the variable
class HelloWorldNode extends EncoderNode
{
    function __construct()
    {
        parent::__construct('hello-worlds', 'hello-world', null);
        $this->addVariable(new EncoderNodeVariable('foo'));
    }
}
// register the node so it becomes known to the encoder
EncoderNode::addNode(new HelloWorldNode());
// create a HelloWorld object
$helloWorld = new HelloWorld();
$helloWorld->setFoo('hello world');
// make an instance of an encoder type and encode the object
$encoder = new XmlEncoder();
$encodedResultXml = $encoder->encode($helloWorld);
// will output:
/* <?xml version="1.0" encoding="UTF-8"?>
 * <encoded>
 *   <hello-world foo="hello world"/>
 * </encoded>
 */
echo htmlentities($encodedResultXml->saveXML());
// decode the XML again
$decoded = $encoder->decode($encodedResultXml->saveXML());
// will output:
/*
Esempio n. 21
0
File: index.php Progetto: Wasage/php
<?php

require_once '/HelloWorld.php';
$bpdo = new PDO('mysql:dbname=test_hello_world;host=localhost', 'root', '');
$bb = new HelloWorld($bpdo);
echo '<div>test 444 New change</div>';
echo $bb->hellostr();
// SHOW DATABASES
// 22222
Esempio n. 22
0
<?php

require_once "HelloWorld.php";
$helloWorld = new HelloWorld();
$helloWorld->sayHello();
Esempio n. 23
0
<?php

class HelloWorld extends Thread
{
    public function __construct($world)
    {
        $this->world = $world;
    }
    public function run()
    {
        print_r(sprintf("Hello %s\n", $this->world));
    }
}
$thread = new HelloWorld("World");
if ($thread->start()) {
    printf("Thread #%lu says: %s\n", $thread->getThreadId(), $thread->join());
}
Esempio n. 24
0
require_once 'lib/HelloWorld.php';
require_once 'lib/Log4Gy.php';
?>

<html>
	<head>
		<title>Page 2</title>
	</head>
	<body>
        <h1>Page 2</h1>
	    <p>
    	    <?php 
Log::info("Début - testLog.php");
Log::start();
$hw = new HelloWorld('Salut :D');
Log::info("Milieu - testLog.php");
Log::conf("le fichier de conf 1");
$hw->doSpeack();
Log::conf("le fichier de conf 2");
function beurj()
{
    Log::debug('Fin - testLog.php');
}
function jaimelespattes()
{
    beurj();
    Log::debug('Fin - sdsds.php');
}
jaimelespattes();
Log::stop();
Esempio n. 25
0
 public function testHello()
 {
     $helloWorld = new HelloWorld($this->pdo);
     $this->assertEquals('Hello Bar', $helloWorld->hello('Bar'));
 }
Esempio n. 26
0
<!doctype html>
<!--
/**
 * Created by PhpStorm.
 * User: ET
 * Date: 6/16/2015
 * Time: 6:22 PM
 */
-->
<html lang="en">
    <head>
        <meta charset="utf-8">
        <title>Hello, World!</title>
    </head>
    <body>
        <?php 
function __autoload($class)
{
    require $class . '.php';
}
$obj = new HelloWorld();
$obj->sayHello();
$obj->sayHello('Italian');
$obj->sayHello('Dutch');
$obj->sayHello('French');
unset($obj);
?>
    </body>
</html>
Esempio n. 27
0
<?php

require_once 'PHP2js.php';
new PHP2js(__FILE__);
/**
 * My super cool php class that will be converted to js!!!
 */
class HelloWorld
{
    /**
     * So here goes a function that echos
     *
     * @param string $foo
     * @param string $bar
     */
    function foo($foo, $bar)
    {
        echo $foo . ' ' . $bar;
    }
}
$H = new HelloWorld();
$H->foo('Hello', 'World');