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


PHP obj::transform方法代码示例

本文整理汇总了PHP中obj::transform方法的典型用法代码示例。如果您正苦于以下问题:PHP obj::transform方法的具体用法?PHP obj::transform怎么用?PHP obj::transform使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在obj的用法示例。


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

示例1: add

	function add() {
		global $check; global $def; global $cookie; global $sets;
		if (!$cookie) $cookie = new dynamic__cookie();

		if (query::$post['mail'] && query::$post['subject']) {
			if ($check->email(query::$post['mail'],false) && query::$post['mail'] != $def['user']['mail']) {
				$cookie->inner_set('user.mail',query::$post['mail']);

				if (!trim(query::$post['user'])) query::$post['user'] = $def['user']['author'];
				if (query::$post['user'] != $def['user']['author']) $cookie->inner_set('user.name',query::$post['user']); else unset(query::$post['user']);

				query::$post['user'] = preg_replace('/#.*$/','',query::$post['user']);

				$category = obj::transform('meta')->category(query::$post['category']);
				$text = obj::transform('text')->format(trim(query::$post['description']));
				if (query::$post['subscribe']) query::$post['subscribe'] = 1;

				obj::db()->insert('orders',$insert_data = array(query::$post['subject'],query::$post['user'],query::$post['mail'],query::$post['subscribe'],$text,undo_safety(query::$post['description']),"",
							$category,0,0,obj::transform('text')->rudate(),$time = ceil(microtime(true)*1000),$def['area'][1]));
				obj::db()->insert('versions',array('order',$id = obj::db()->sql('select @@identity from orders',2),
												base64_encode(serialize($insert_data)),$time,$sets['user']['name'],$_SERVER['REMOTE_ADDR']));
				if (query::$post['subscribe']) $this->set_events($id,query::$post['mail']); else $this->set_events($id);
				$this->add_res('Заказ успешно добавлен. Страница заказа: <a href="/order/'.$id.'/">http://4otaku.org/order/'.$id.'</a>');
			}
			else $this->add_res('Вы указали неправильный е-мейл.', true);
		}
		else $this->add_res('Не все обязательные поля заполнены.', true);
	}
开发者ID:4otaku,项目名称:4otaku,代码行数:28,代码来源:order.php

示例2: edit_art_translations

	function edit_art_translations() {
		global $def; global $check;
		if ($check->num(query::$post['id']) && query::$post['type'] == 'art') {
			$time = microtime(true)*1000;
			$date = obj::transform('text')->rudate();
			obj::db()->update('art_translation','active',0,query::$post['id'],'art_id');
			if (query::$post['size'] == 'resized') {
				$info = obj::db()->sql('select resized, md5 from art where id='.query::$post['id'],1);
				$full_size = explode('x',$info['resized']);
				$small_size = getimagesize(ROOT_DIR.SL.'images/booru/resized/'.$info['md5'].'.jpg');
				$coeff = $full_size[0] / $small_size[0];
			} else {
				$coeff = 1;
			}
			foreach (query::$post['trans'] as $key => $translation) {
				if (!$text = obj::transform('text')->format($translation['text']))
					unset (query::$post['trans'][$key]);
				else {
					foreach ($translation as $key2 => $one) if ($key2 != 'text') query::$post['trans'][$key][$key2] = round(intval($one) * $coeff);
					query::$post['trans'][$key]['pretty_text'] = $translation['text']; query::$post['trans'][$key]['text'] = $text;
				}
			}
			obj::db()->insert('art_translation',array(query::$post['id'],base64_encode(serialize(query::$post['trans'])),query::$post['author'],$date,$time,1));
			obj::db()->sql('update art set translator="'.query::$post['author'].'" where id='.query::$post['id'].' and translator=""',0);
		}
	}
开发者ID:4otaku,项目名称:4otaku,代码行数:26,代码来源:art.php

示例3: update

	function update() {
		$return = obj::db()->sql('select * from post_update order by sortdate desc limit 3');
		if (!empty($return) && is_array($return))
			foreach ($return as & $update) {
				$update['text'] = obj::transform('text')->cut_long_text(strip_tags($update['text'],'<br>'),100);
				$update['text'] = preg_replace('/(<br(\s[^>]*)?>\n*)+/si','<br />',$update['text']);
				$update['text'] = obj::transform('text')->cut_long_words($update['text']);
				$update['author'] = mb_substr($update['username'],0,20);
				$update['post_title'] = obj::db()->sql('select title from post where id = '.$update['post_id'],2);
			}

		return $return;
	}
开发者ID:4otaku,项目名称:4otaku,代码行数:13,代码来源:sidebar.php

示例4: archive_author

	function archive_author() {
		global $url;
		if ($url[2] != 'art') { $title = ' title,'; $return['display'] = array('archive_body'); }
		else $return['display'] = array('archive_artbody');
		$items = obj::db()->sql('select author,'.$title.' id, comment_count from '.$url[2].' where area="main" order by sortdate');
		$return['count'] = count($items).' '.obj::transform('text')->wcase(count($items),$this->wcase[$url[2]][0],$this->wcase[$url[2]][1],$this->wcase[$url[2]][2]);
		if (is_array($items)) foreach ($items as $item) {
			$authors = explode('|',trim($item['author'],'|'));
			foreach ($authors as $author)
				if ($url[2] != 'art') $return['archives'][$author][] = $item;
				else $return['archives'][$author]++;
		}
		$return['name'] = obj::db()->sql('select alias,name from author','alias');
		return $return;
	}
开发者ID:4otaku,项目名称:4otaku,代码行数:15,代码来源:archive.php

示例5: duplicates

	function duplicates($return) {
		$return['display'][] = 'admin_duplicateslist';
		$duplicates = obj::db()->sql('select id, similar from art_similar where similar != "|" and similar != ""','id');

		if(is_array($duplicates))
		{
			$art_ids = array();
			$pairings = array();

			foreach ($duplicates as $id => $similar) {
				$similar = explode('|', trim($similar, '|'));
				foreach ($similar as $item) {
					$art_ids[] = $item;
					$pairings[] = min($id,$item).'-'.max($id,$item);
				}
				$art_ids[] = $id;
			}

			$art_ids = array_unique($art_ids);
			$return['doubles'] = array_unique($pairings);

			$return['arts'] = obj::db()->sql('select * from art where id in ("'.implode('","', $art_ids).'")','id');

			$translations = obj::db()->sql('select art_id from art_translation where art_id in ("'.implode('","', $art_ids).'")');

			foreach ($return['arts'] as $id => $art) {
				$image = ROOT_DIR.SL.'images'.SL.'booru'.SL.'full'.SL.$art['md5'].'.'.$art['extension'];
				$fileinfo = getimagesize($image);
				$return['arts'][$id]['width'] = $fileinfo[0];
				$return['arts'][$id]['height'] = $fileinfo[1];
				$return['arts'][$id]['size'] = obj::transform('file')->weight(filesize($image));
				$return['arts'][$id]['translation'] = in_array($id, (array) $translations);
			}
			unset ($art);

			$meta = $this->get_meta($return['arts'],array('tag'));
			foreach ($return['arts'] as &$art)
				foreach ($meta['tag'] as $alias => $name)
					if (stristr($art['tag'],'|'.$alias.'|'))
						$art['meta']['tag'][$alias] = $name['name'];

			unset ($art);
		}

		return $return;
	}
开发者ID:4otaku,项目名称:4otaku,代码行数:46,代码来源:admin.php

示例6: if

					 target="_blank" class="board_flash with_help"
					 title="<?php 
echo $flash['full_size_info'];
?>
">
					<img align="left" src="<?php 
echo $def['site']['dir'];
?>
/images/flash.png">
				</a>
		<? } } ?>
		<? if (!empty($thread['multi_content'])) { ?>
			<div class="clear"></div>
		<? } ?>
		<div class="posttext">
			<? if ($url[3] != 'thread') { ?>
				<?php 
echo obj::transform('text')->cut_long_text($thread['text'], 1000, $read_all, 100);
?>
			<? } else { ?>
				<?php 
echo $thread['text'];
?>
			<? } ?>
		</div>
	</div>
	<? if (!empty($thread['multi_content'])) { ?>
		<div class="clear"></div>
	<? } ?>
</div>
开发者ID:4otaku,项目名称:4otaku,代码行数:30,代码来源:thread_message.php

示例7: if

					<? if (!empty($thread['skipped']['images'])) { ?>
						,
						 <?php 
echo $thread['skipped']['images'];
?>
						 <?php 
echo obj::transform('text')->wcase($thread['skipped']['images'], 'картинка', 'картинки', 'картинок');
?>
					<? } ?>
					<? if (!empty($thread['skipped']['flash'])) { ?>
						,
						 <?php 
echo $thread['skipped']['flash'];
?>
						 <?php 
echo obj::transform('text')->wcase($thread['skipped']['flash'], 'флешка', 'флешки', 'флешек');
?>
					<? } ?>
					<? if (!empty($thread['skipped']['video'])) { ?>
						,
						 <?php 
echo $thread['skipped']['video'];
?>
						 видео
					<? } ?>
				</div>
			<? } ?>
			<? foreach ($thread['posts'] as $post) { ?>
				<? include TEMPLATE_DIR .SL.'main'.SL.'board'.SL.'message.php'; ?>
			<? }
		}
开发者ID:4otaku,项目名称:4otaku,代码行数:31,代码来源:page.php

示例8:

								?>
									<td class="imageholder">
										<div class="image-0">
											<img src="<?php 
echo $block['image'];
?>
" />
										</div>
									</td>
								<?
							}
						?>						
						<td valign="top">
							<?php 
echo $block['comment_count'] > $sets['pp']['comment_in_post'] ? '<p class="help">
									Показываются только ' . $sets['pp']['comment_in_post'] . ' последних ' . obj::transform('text')->wcase(sets::pp('comment_in_post'), 'комментарий', 'комментария', 'комментариев') . '. 
									<a href="' . $def['site']['dir'] . '/' . $block['place'] . '/' . $block['id'] . '/comments/all">
										Читать все
									</a>.
								</p>' : '';
?>
							<?	
								$i = $block['comment_count'];
								foreach ($block['comments'] as $comment) { 
									$i--; 
									if ($i < $sets['pp']['comment_in_post']) {
										?>
											<div class="comment" id="comment-<?php 
echo $comment['id'];
?>
"<?php 
开发者ID:4otaku,项目名称:4otaku,代码行数:31,代码来源:commentline.php

示例9: foreach

<?php

die;
include '../inc.common.php';
$posts = Database::get_full_vector('board');
foreach ($posts as $id => $post) {
    $text = obj::transform('text')->wakaba(redo_safety($post['pretty_text']));
    Database::update('board', array('text' => $text), $id);
}
开发者ID:4otaku,项目名称:4otaku,代码行数:9,代码来源:fix_board_text.php

示例10: pack_edit

	public function pack_edit () {
		global $check;
		if ($check->rights()) {
			$id = query::$post['id'];

			$text = obj::transform('text')->format(trim(query::$post['text']));
			$pretty_text = trim(query::$post['text']);

			$update = array(
				'title' => query::$post['name'],
				'text' => $text,
				'pretty_text' => $pretty_text,
			);

			obj::db()->update('art_pack',array_keys($update),array_values($update), $id);
		}
	}
开发者ID:4otaku,项目名称:4otaku,代码行数:17,代码来源:admin.php

示例11: process_content

	function process_content(&$array) {
		global $url;
		$images_count = 0; $video_count = 0; $flash_count = 0;
		if (!empty($array)) {
			$ids = array_keys($array);
			$content_array = (array) obj::db()->sql('
				SELECT * FROM board_attachment
				WHERE post_id in ('.implode(',',$ids).')
				ORDER BY `order`
			');

			foreach ($array as $key => $item) {
				$array[$key]['content'] = array(
					'image' => array(),
					'flash' => array(),
					'video' => array(),
				);
			}


			foreach ($content_array as $content) {
				$array[$content['post_id']]['content'][$content['type']][] =
					unserialize(base64_decode($content['data']));
			}

			foreach ($array as $key => $item) {

				if (!empty($item['content'])) {
					$content = $item['content'];
					$current_count = 0;

					if (!empty($content['image'])) {
						foreach ($content['image'] as $image_key => $image) {
							$content['image'][$image_key]['full_size_info'] =
								obj::transform('file')->weight($image['weight']) .
								', ' . $image['sizes'] . ' пикселей';

							$images_count++;
							$current_count++;
						}
					}

					if (!empty($content['random'])) {
						foreach ($content['random'] as $random_key => $image) {
							$content['random'][$random_key]['full_size_info'] =
								obj::transform('file')->weight($image['size']) .
								', ' . $image['width'] . 'x' . $image['height'] . ' пикселей';

							$images_count++;
							$current_count++;
						}
					}

					if (!empty($content['flash'])) {
						foreach ($content['flash'] as $flash_key => $flash) {
							$content['flash'][$flash_key]['full_size_info'] =
								obj::transform('file')->weight($flash['weight']);

							$flash_count++;
							$current_count++;
						}
					}

					if (!empty($content['video'])) {
						$width = def::board('thumbwidth');

						foreach ($content['video'] as $video_key => $video) {
							$height = $width * $video['aspect'];

							$content['video'][$video_key]['object'] = str_replace(
								array('%video_width%','%video_height%'),
								array($width,$height),
								$video['object']
							);

							$content['video'][$video_key]['height'] = $height;

							$video_count++;
							$current_count++;
						}
					}

					$array[$key]['content'] = $content;
				}

				if (!empty($item['boards'])) {
					$array[$key]['boards'] = array_values(array_filter(array_unique(explode('|',$item['boards']))));
				}
				if ($url[2] && strlen($url[2]) < 3) {
					$array[$key]['current_board'] = $url[2];
				} elseif (!empty($array[$key]['categories'])) {
					$c_key = array_rand($array[$key]['categories']);
					$array[$key]['current_board'] = $array[$key]['categories'][$c_key]['alias'];
				}

				if (!empty($item['text'])) {
					preg_match_all('/&gt;&gt;(\d+)(\s|$|<br[^>]*>)/',$item['text'],$inner_links);
					foreach ($inner_links[1] as $inner_link) {
						$this->inner_links[] = $inner_link;
					}
//.........这里部分代码省略.........
开发者ID:4otaku,项目名称:4otaku,代码行数:101,代码来源:board.php

示例12: format_logs

 function format_logs($text, $author = false, $mark = array())
 {
     $text = str_replace(array('<', '>'), array('&lt;', '&gt;'), $text);
     foreach ($mark as $one) {
         $text = preg_replace('/(?<=\\b)' . preg_quote($one, '/') . '(?=\\b)/uis', '<span style="background-color:yellow;">$0</span>', $text);
     }
     $text = preg_replace(array("/[\r\n]+/su"), array("<br />"), $text);
     $text = preg_replace(transform__text::URL_REGEX, '<a href="$0">$0</a>', $text);
     $text = obj::transform('text')->cut_long_words($text, 40);
     if (substr($text, 0, 3) == '/me') {
         return '<span class="logs-nick">' . $author . '</span>' . substr($text, 3);
     } else {
         return ($author ? '<span class="logs-nick">&lt;' . $author . '&gt;</span> ' : '') . $text;
     }
 }
开发者ID:4otaku,项目名称:4otaku,代码行数:15,代码来源:logs_abstract.php

示例13: if

echo $flash['full'];
?>
"
					 target="_blank" class="board_flash with_help"
					 title="<?php 
echo $flash['full_size_info'];
?>
">
					<img align="left" src="<?php 
echo $def['site']['dir'];
?>
/images/flash.png">
				</a>
		<? } } ?>
		<? if (!empty($post['multi_content'])) { ?>
			<div class="clear"></div>
		<? } ?>
		<div class="posttext">
			<? if ($url[3] != 'thread') { ?>
				<?php 
echo obj::transform('text')->cut_long_text($post['text'], 800, $read_all, 100);
?>
			<? } else { ?>
				<?php 
echo $post['text'];
?>
			<? } ?>
		</div>
	</div>
</div>
开发者ID:4otaku,项目名称:4otaku,代码行数:30,代码来源:message.php

示例14: add

	function add() {
		global $check; global $def; global $sets; global $cookie; global $add_res;
		if (!$cookie) $cookie = new dynamic__cookie();

		$content = array();
		$count_content = 0;

		if (!empty(query::$post['image']) && is_array(query::$post['image'])) {

			foreach (query::$post['image'] as $add_image) {
				if ($count_content >= def::board('maxcontent')) {
					continue;
				}

				$count_content++;

				if (array_key_exists($add_image, $this->random_codes)) {
					$random_art = $this->get_random_art($this->random_codes[$add_image]);

					if ($random_art) {
						$name = $random_art['md5'] . '.' . $random_art['extension'];
						$path = IMAGES . SL . 'booru' . SL . 'full' . SL . $name;

						try {
							$resizer = new Transform_Upload_Board_Image($path, $name);
							$result = $resizer->process_file();
						} catch (Error_Upload $e) {
							continue;
						}

						if (empty($result['success'])) {
							continue;
						}

						$content['random'][] = array(
							'id' => $random_art['id'],
							'full' => $result['full'],
							'thumb' => $result['thumb'],
							'size' => $result['size'],
							'width' => $result['width'],
							'height' => $result['height'],
						);
					}

					continue;
				}

				$parts = explode('#', $add_image);
				if ($parts[1] == 'flash') {
					$content['flash'][] = array(
						'full' => $parts[0],
						'weight' => $parts[2],
					);
				} else {
					$content['image'][] = array(
						'full' => $parts[0],
						'thumb' => $parts[1],
						'weight' => $parts[2],
						'sizes' => $parts[3],
					);
				}
			}
		}

		if (!empty(query::$post['video']) && is_array(query::$post['video'])) {
			query::$post['video'] = array_unique(query::$post['video']);

			foreach (query::$post['video'] as $add_video) {
				if (empty($add_video) || $count_content >= def::board('maxcontent')) {
					continue;
				}
				$video_link = undo_safety($add_video);
				$video_worker = new Transform_Video($video_link);
				$video_object = $video_worker->disable_nico()->get_html();

				if (empty($video_object)) {
					$this->add_res(
						'Извините, видеосервиса для ссылки '.
						'('.$add_video.') нет в нашей базе, '.
						'либо с вашей ссылкой что-то не так.'
					,true);
					continue;
				}
				$content['video'][] = array(
					'link' => $video_link,
					'object' => $video_object,
					'service_id' => $video_worker->get_id(),
					'aspect' => $video_worker->get_aspect(),
				);
				$count_content++;
			}
		}

		$text = obj::transform('text')->wakaba(query::$post['text']);

		$is_thread = (bool) empty(query::$post['id']);

		if ($is_thread + empty($content) + empty($text) <= 1) {

			$trip = preg_split('/(?<!&)#/', query::$post['user']);
//.........这里部分代码省略.........
开发者ID:4otaku,项目名称:4otaku,代码行数:101,代码来源:board.php

示例15: substract_category

	function substract_category($category,$id) {

		Check::rights();

		$categories = explode('|',trim(obj::db()->sql('select category from art where id='.$id,2),'|'));
		$categories = array_diff($categories,array($category));
		if (empty($categories)) $categories = array('none');
		$category = obj::transform('meta')->category($categories);
		obj::db()->update('art','category',$category,$id);
	}
开发者ID:4otaku,项目名称:4otaku,代码行数:10,代码来源:art.php


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