本文整理汇总了PHP中Object::add方法的典型用法代码示例。如果您正苦于以下问题:PHP Object::add方法的具体用法?PHP Object::add怎么用?PHP Object::add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Object
的用法示例。
在下文中一共展示了Object::add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isExsistDomain
function isExsistDomain($domain, $client_srl = null)
{
$result = new Object();
$domain = str_replace(array('http://', 'www.'), '', $domain);
// DB에서 검색
$args->domain = $domain;
$args->client_srl = $client_srl;
$output = executeQueryArray('socialxeserver.getClientByDomain', $args);
if (!$output->toBool()) {
return $output;
}
// 검색 결과가 없으면 false
if (!$output->data) {
$result->add('result', false);
return $result;
}
// DB 검색 결과에서 도메인을 하나씩 체크
foreach ($output->data as $client) {
$domain_array = explode(',', $client->domain);
foreach ($domain_array as $val) {
// 정확히 일치하는지를 검사
if (trim($val) == $domain) {
$result->add('result', true);
return $result;
}
}
}
// 일치하는 도메인이 없으면 false
$result->add('result', false);
return $result;
}
示例2: test_aBunchOfMatchCases
/**
* Test matching in various positions with various keys etc
*
*
* @return void
* @author Dan Cox
*/
public function test_aBunchOfMatchCases()
{
$this->collection->add('test1', 'value');
$this->collection->add('test2', 'val');
$this->collection->add('s./28', 'weird');
$str1 = '[test1]';
$str2 = '[test1][test2]';
$str3 = '[test1] [test2]';
$str4 = 'Text [nomask] first [test1]';
$str5 = '[test1] then text, then [test2]';
$str6 = '[s./28]';
$str8 = 'Test then value str [test1, value="value"]';
// Lets get matching!
$matches1 = $this->matcher->load($str1, $this->collection)->search()->getRawMatches();
$matches2 = $this->matcher->load($str2, $this->collection)->search()->getRawMatches();
$matches3 = $this->matcher->load($str3, $this->collection)->search()->getRawMatches();
$matches4 = $this->matcher->load($str4, $this->collection)->search()->getRawMatches();
$matches5 = $this->matcher->load($str5, $this->collection)->search()->getRawMatches();
$matches6 = $this->matcher->load($str6, $this->collection)->search()->getRawMatches();
$matches8 = $this->matcher->load($str8, $this->collection)->search()->getRawMatches();
$this->assertEquals(array('[test1]'), $matches1);
$this->assertEquals(array('[test1]', '[test2]'), $matches2);
$this->assertEquals(array('[test1]', '[test2]'), $matches3);
$this->assertEquals(array('[test1]'), $matches4);
$this->assertEquals(array('[test1]', '[test2]'), $matches5);
$this->assertEquals(array(), $matches6);
$this->assertEquals(array('[test1, value="value"]'), $matches8);
}
示例3: test_gettingSettingCollectionBag
/**
* Test the basic functions of the collection bag
*
* @return void
* @author Dan Cox
*/
public function test_gettingSettingCollectionBag()
{
$this->collection->add('foo', 'bar');
$this->assertTrue($this->collection->getMethod()->has('foo'));
$this->assertEquals('bar', $this->collection->getMethod()->get('foo'));
$this->assertEquals(array('foo' => 'bar'), $this->collection->getMethod()->all());
}
示例4: Load
public function Load()
{
parent::$PAGE_TITLE = __(ERROR_USER_BANNED) . " - " . __(SITE_NAME);
parent::$PAGE_META_ROBOTS = "noindex, nofollow";
$can_use_captacha = true;
if (WspBannedVisitors::isBannedIp($this->getRemoteIP())) {
$last_access = new DateTime(WspBannedVisitors::getBannedIpLastAccess($this->getRemoteIP()));
$duration = WspBannedVisitors::getBannedIpDuration($this->getRemoteIP());
$dte_ban = $last_access->modify("+" . $duration . " seconds");
if ($dte_ban > new DateTime()) {
$can_use_captacha = false;
}
}
$obj_error_msg = new Object(new Picture("wsp/img/warning.png", 48, 48, 0, "absmidlle"), "<br/><br/>");
$obj_error_msg->add(new Label(__(ERROR_USER_BANNED_MSG_1), true), "<br/>");
if ($can_use_captacha) {
$obj_error_msg->add(new Label(__(ERROR_USER_BANNED_MSG_2), true), "<br/><br/>");
$this->captcha_error_obj = new Object();
$form = new Form($this);
$this->captcha = new Captcha($form);
$this->captcha->setFocus();
$unblock_btn = new Button($form);
$unblock_btn->setValue(__(ERROR_USER_BUTTON))->onClick("onClickUnblock");
$form->setContent(new Object($this->captcha, "<br/>", $unblock_btn));
$obj_error_msg->add($this->captcha_error_obj, "<br/>", $form);
}
$obj_error_msg->add("<br/><br/>", __(MAIN_PAGE_GO_BACK), new Link(BASE_URL, Link::TARGET_NONE, __(SITE_NAME)));
$this->render = new ErrorTemplate($obj_error_msg, __(ERROR_USER_BANNED));
}
示例5: test_addGet
/**
* Test adding and getting back class
*
* @return void
* @author Dan Cox
*/
public function test_addGet()
{
$arr = array('task' => array('name' => 'Command', 'description' => '', 'actions' => ['main', 'run']), 'class' => 'TEST');
$this->library->add($arr);
// Now find this by its command name
$val = $this->library->find('Command:run');
$this->assertEquals('TEST', $val);
}
示例6: Load
public function Load()
{
parent::$PAGE_TITLE = __(CONFIGURE_MODULES);
$config_modules_obj = new Object();
$construction_page = new Object(__(PAGE_IN_CONSTRUCTION));
$construction_page->setClass("warning");
$config_modules_obj->add($construction_page);
$config_modules_obj->add("<br/>", __(PRESENTATION), "<br/><br/>");
$sort_event_install = new SortableEvent($this);
$sort_event_install->onSort("onChangeModule")->setAjaxEvent()->disableAjaxWaitMessage();
$this->list_install_modules_obj = new Object();
$this->list_install_modules_obj->setId("list_install_modules");
$this->list_install_modules_obj->setSortable(true, $sort_event_install);
$list_all_install_modules_obj = new Object();
$module_style = "cursor:pointer;width:100px;border:1px solid gray;padding:2px;margin:2px;";
$array_active_modules = array();
$module_file = new File(dirname(__FILE__) . "/../../../wsp/config/modules.cnf");
while (($line = $module_file->read_line()) != false) {
if (trim($line) != "") {
$array_active_modules[] = trim($line);
$module_obj = new Object(trim($line));
$module_obj->setId("module_" . str_replace("-", "_", trim($line)))->forceDivTag();
if (trim($line) != "Authentication") {
$module_obj->setStyle($module_style);
$module_obj->setDraggable(true, false, null, true);
$this->list_install_modules_obj->add($module_obj);
} else {
$module_obj->setStyle($module_style . "cursor:none;");
$list_all_install_modules_obj->add($module_obj);
}
}
}
$module_file->close();
$list_all_install_modules_obj->add($this->list_install_modules_obj);
$sort_event = new SortableEvent($this);
$sort_event->onSort("onChangeModule")->setAjaxEvent()->disableAjaxWaitMessage();
$this->list_modules_obj = new Object();
$this->list_modules_obj->setId("list_modules");
$this->list_modules_obj->setSortable(true, $sort_event);
$folder = dirname(__FILE__) . "/../../../wsp/class/modules";
$array_module_dir = scandir($folder);
for ($i = 0; $i < sizeof($array_module_dir); $i++) {
if (is_dir($folder . "/" . $array_module_dir[$i]) && !in_array($array_module_dir[$i], $array_active_modules) && $array_module_dir[$i] != "." && $array_module_dir[$i] != ".." && $array_module_dir[$i] != ".svn") {
$module_obj = new Object($array_module_dir[$i]);
$module_obj->setId("module_" . str_replace("-", "_", $array_module_dir[$i]))->forceDivTag();
$module_obj->setDraggable(true, false, null, true)->setStyle($module_style);
$this->list_modules_obj->add($module_obj);
}
}
$config_table = new Table();
$config_table->setWidth(400)->setDefaultAlign(RowTable::ALIGN_CENTER);
$config_table->setDefaultValign(RowTable::VALIGN_TOP);
$config_table->addRowColumns(new Object(new Label(__(ALL_MODULES), true), "<br/>", $this->list_modules_obj), " ", new Object(new Label(__(INSTALLED_MODULES), true), "<br/>", $list_all_install_modules_obj));
$config_modules_obj->add($config_table, "<br/><br/>");
$this->render = new AdminTemplateForm($this, $config_modules_obj);
}
示例7: setUp
/**
* Set up test vars
*
* @return void
* @author Dan Cox
*/
public function setUp()
{
$this->CT = new CommandTester();
// Setup some fake app details
$app = $this->CT->getApplication();
$app->setName('Test CLI');
$app->setVersion('1.0.0');
// Add some tasks to play with
$this->CT->add(new FakeTask());
}
示例8: testArrays
public function testArrays()
{
$Split1 = new Split(1.0, 260, false);
$Split2 = new Split(1.0, 200, true);
$Splits1 = new Object(array($Split1, $Split2));
$Splits2 = new Object();
$Splits2->add($Split1);
$Splits2->add($Split2);
$this->assertEquals(2, count($Splits1->asArray()));
$this->assertEquals($Splits1->asArray(), $Splits2->asArray());
}
示例9: Load
public function Load()
{
parent::$PAGE_TITLE = __(CONFIGURE_USERS);
$config_users_obj = new Object("<br/>");
$this->result_obj = new Object();
$this->result_obj->setId("page_result_area");
$config_users_obj->add($this->result_obj);
$this->users_table_obj = new Object();
$this->users_table_obj->setId("users_table_obj");
$config_users_obj->add($this->users_table_obj, "<br/><br/>");
$user_table = new Table();
$form = new Form($this);
if (extension_loaded('openssl')) {
$form->setEncryptObject(new EncryptDataWspObject());
}
$this->edt_login = new TextBox($form);
$validation = new LiveValidation();
$user_table->addRowColumns(__(LOGIN) . ": ", $this->edt_login->setLiveValidation($validation->addValidatePresence()));
$this->cmb_rights = new ComboBox($form);
$this->cmb_rights->addItem(Page::RIGHTS_ADMINISTRATOR, "Administrator");
$this->cmb_rights->addItem(Page::RIGHTS_MODERATOR, "Moderator");
$this->cmb_rights->addItem(Page::RIGHTS_TRANSLATOR, "Translator");
$this->cmb_rights->addItem(Page::RIGHTS_DEVELOPER, "Developer");
$this->cmb_rights->addItem(Page::RIGHTS_AUTH_USER, "Authentificated user");
$this->cmb_rights->addItem(Page::RIGHTS_GUEST, "Guest");
$user_table->addRowColumns(__(RIGHTS) . ": ", $this->cmb_rights);
$this->edt_old_password = new Password($form);
$validation = new LiveValidation();
$this->old_passwd_row = $user_table->addRowColumns(__(OLD_PASSWORD) . ": ", $this->edt_old_password->setLiveValidation($validation->addValidatePresence()->setFieldName(__(OLD_PASSWORD))));
$this->old_passwd_row->setId("old_passwd_row");
$this->edt_password = new Password($form);
$validation = new LiveValidation();
$user_table->addRowColumns(__(PASSWORD) . ": ", $this->edt_password->setLiveValidation($validation->addValidatePresence()->setFieldName(__(PASSWORD))));
$this->edt_confirm_passwd = new Password($form);
$live_validation = new LiveValidation();
$live_validation->addValidatePresence()->setFieldName(__(CONFIRM_PASSWD));
$live_validation->addValidateConfirmation($this->edt_password->getId());
$user_table->addRowColumns(__(CONFIRM_PASSWD) . " : ", $this->edt_confirm_passwd->setLiveValidation($live_validation))->setStyle("color:black;");
$user_table->addRow();
$this->validate_btn = new Button($form);
$this->validate_btn->setValue(__(ADD))->onClick("addWspUser")->setAjaxEvent()->disableAjaxWaitMessage()->assignEnterKey();
$this->modify_btn = new Button($form);
$this->modify_btn->setValue(__(SAVE))->onClick("changeWspUser")->setAjaxEvent()->disableAjaxWaitMessage()->assignEnterKey();
$this->cancel_btn = new Button($this);
$this->cancel_btn->setValue(__(CANCEL))->onClick("refresh")->setAjaxEvent()->disableAjaxWaitMessage();
$modif_btn_table = new Table();
$modif_btn_table->addRowColumns($this->validate_btn, " ", $this->modify_btn, " ", $this->cancel_btn);
$user_table->addRow($modif_btn_table)->setColspan(2)->setAlign(RowTable::ALIGN_CENTER);
$config_users_obj->add($form->setContent($user_table), "<br/><br/>");
$this->render = new AdminTemplateForm($this, $config_users_obj);
}
示例10: Object
/**
* @brief LDAP 연동하여 정보를 return하는 method
**/
function ldap_conn($user_id, $password, $ldap_userdn_prefix, $ldap_userdn_suffix, $base_dn, $ldap_server, $ldap_port = 389)
{
if (!function_exists('ldap_connect')) {
return new Object(-1, 'ldap module is not exists');
}
$ds = @ldap_connect($ldap_server, $ldap_port);
if (!$ds) {
return new Object(-1, 'server not connected');
}
if (!ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3)) {
return new Object(-1, 'fail to set option');
}
$userdn = $ldap_userdn_prefix . $user_id . $ldap_userdn_suffix;
if (!@ldap_bind($ds, $userdn, $password)) {
return new Object(-1, 'fail to bind');
}
$ldap_sr = @ldap_search($ds, $base_dn, '(cn=' . $user_id . ')', array('*'));
if (!$ldap_sr) {
return new Object(-1, 'fail to search');
}
$info = ldap_get_entries($ds, $ldap_sr);
if ($info['count'] < 1 || !is_array($info) || !count($info[0])) {
return new Object(-1, 'not found');
}
$obj = new Object();
foreach ($info[0] as $key => $val) {
if (preg_match('/^[0-9]*$/', $key) || $key == 'objectclass') {
continue;
}
$obj->add($key, $val[0]);
}
return $obj;
}
示例11: define
function __construct($content, $title)
{
parent::__construct();
define(GOOGLE_CODE_TRACKER_NOT_ACTIF, true);
$this->render = new Table();
$this->render->setWidth("100%");
// Header
if (defined('SITE_META_OPENGRAPH_IMAGE') && SITE_META_OPENGRAPH_IMAGE != "") {
$logo = new Picture(SITE_META_OPENGRAPH_IMAGE);
} else {
$logo = new Picture("img/logo_128x400_" . $_SESSION['lang'] . ".png", 128, 400);
}
$logo->setTitle(__(SITE_NAME));
$logo_link = new Link($this->getPage()->getBaseLanguageURL(), Link::TARGET_NONE, $logo);
$img_obj = new Object($logo_link);
$img_obj->add("<br/><br/>");
$this->render->addRow($img_obj);
$this->render->addRow();
// Error message
$small_img = new Picture("wsp/img/warning_16.png", 16, 16, 0, "absmiddle");
$title_header = new Object($small_img, $title);
$error_box = new Box($title_header, true, Box::STYLE_MAIN, Box::STYLE_MAIN, '', 'error_box', 700);
$error_box->setContent($content);
$this->render->addRow($error_box);
}
示例12: processPayment
function processPayment($args)
{
$output = new Object();
$output->add('state', '2');
// not completed
$output->add('payment_method', 'ZP');
$output->add('payment_amount', $args->price);
$output->add('result_code', '0');
$output->add('result_message', 'success');
$output->add('pg_tid', $this->keygen());
$output->add('vact_bankname', $this->plugin_info->bank_name);
$output->add('vact_num', $this->plugin_info->account_number);
$output->add('vact_name', $this->plugin_info->account_holder);
$output->add('vact_inputname', $args->depositor_name);
return $output;
}
示例13: Load
public function Load()
{
parent::$PAGE_TITLE = __(CONFIGURE_BANNED_VISITORS);
if (!defined('MAX_BAD_URL_BEFORE_BANNED')) {
define("MAX_BAD_URL_BEFORE_BANNED", 4);
}
$this->array_wsp_banned_users = WspBannedVisitors::getBannedVisitors();
$this->table_ban = new Table();
$this->table_ban->setId("table_ban")->activateAdvanceTable()->activatePagination()->activateSort(2, "desc")->setWidth(500);
$this->table_ban->addRowColumns("IP", __(LAST_ACCESS), __(DURATION), __(AUTHORIZE))->setHeaderClass(0);
$ban_vistors_obj = new Object("<br/><br/>", $this->table_ban, "<br/><br/>");
$ban_ip_table = new Table();
$form = new Form($this);
$this->ip_edt = new TextBox($form);
$validation = new LiveValidation();
$validation->addValidatePresence();
$this->ip_edt->setLiveValidation($validation);
$this->duration_edt = new TextBox($form);
$this->duration_edt->setValue(0);
$validation = new LiveValidation();
$validation->addValidatePresence()->addValidateNumericality(true);
$this->duration_edt->setLiveValidation($validation);
$ip_btn = new Button($form);
$ip_btn->setValue(__(BAN_IP))->onClick("onBannedIP")->setAjaxEvent();
$ban_ip_table->addRowColumns("IP : ", $this->ip_edt);
$ban_ip_table->addRowColumns(__(DURATION) . " : ", $this->duration_edt);
$form->setContent(new Object($ban_ip_table, $ip_btn));
$ban_vistors_obj->add($form, "<br/><br/>");
$this->render = new AdminTemplateForm($this, $ban_vistors_obj);
}
示例14: processRoute
/**
* Adds a route to the appropriate collection
*
* @param String $name
* @param SymfonyRoute $route
* @return void
* @author Dan Cox
**/
public function processRoute($name, $route)
{
if (!is_null($this->activeGroup)) {
$this->activeGroup->add($name, $route);
} else {
$this->collection->add($name, $route);
}
}
示例15: Load
public function Load()
{
header($_SERVER["SERVER_PROTOCOL"] . " 401 Unauthorized");
parent::$PAGE_TITLE = __(ERROR_USER_RIGHTS) . " - " . __(SITE_NAME);
parent::$PAGE_META_ROBOTS = "noindex, nofollow";
$obj_error_msg = new Object(new Picture("wsp/img/warning.png", 48, 48, 0, "absmidlle"), "<br/>", new Label(__(ERROR_USER_RIGHTS_MSG)));
$obj_error_msg->add("<br/><br/>", __(MAIN_PAGE_GO_BACK), new Link(BASE_URL, Link::TARGET_NONE, __(SITE_NAME)));
$this->render = new ErrorTemplate($obj_error_msg, __(ERROR_USER_RIGHTS));
}