本文整理汇总了PHP中WM_Router::pinAction方法的典型用法代码示例。如果您正苦于以下问题:PHP WM_Router::pinAction方法的具体用法?PHP WM_Router::pinAction怎么用?PHP WM_Router::pinAction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WM_Router
的用法示例。
在下文中一共展示了WM_Router::pinAction方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: indexAction
public function indexAction()
{
$this->noViewRenderer(true);
$request = $this->getRequest();
if ($request->getRequest('type') !== 'create') {
return;
}
$settings = Model_Extensions::getSettingsPairs('facebook');
if (isset($settings['facebook_add_pin_to_facebook_timeline']) && $settings['facebook_add_pin_to_facebook_timeline']) {
$user_id = $request->getParam('user');
$pin_id = $request->getParam('pin');
if ($user_id && $pin_id) {
$connectObject = new Model_Facebook_Login();
$user_fb = $connectObject->getDataByUserId($user_id);
if ($user_fb && $user_fb['timeline']) {
$facebook = new Helper_Modules_Facebook();
$pin_url = WM_Router::pinAction($pin_id);
$params = array('link' => $pin_url, 'access_token' => $user_fb['access_token'], 'cb' => '');
$response = $facebook->facebook->api('/me/feed', 'post', $params);
if ($settings['facebook_og_namespace'] && $settings['facebook_og_recipe']) {
$params = array($settings['facebook_og_recipe'] => $pin_url, 'access_token' => $user_fb['access_token']);
$response1 = $facebook->facebook->api('/me/' . $settings['facebook_og_namespace'] . ':' . $settings['facebook_og_recipe'], 'post', $params);
}
}
}
}
}
示例2: fromatListUserFollowers
public function fromatListUserFollowers($user)
{
$request = $this->getRequest();
$limit_thumbs = 8;
$pins_filter = array();
$latest = explode(',', $user['latest_pins']);
if ($latest) {
foreach ($latest as $l) {
if ($l) {
$pins_filter[] = $l;
}
}
}
$pins = $pins_filter ? new Model_Pins_PinsThumbsForFollowersAndFollowing(array('pins' => $pins_filter, 'start' => 0, 'limit' => $limit_thumbs)) : new ArrayObject();
$thumbs = array();
$total_pins = $pins->count();
for ($i = 0; $i < min($limit_thumbs, $total_pins); $i++) {
if (isset($pins->data[$i])) {
$pin = $pins->data[$i];
$thumbs[] = array('images' => Helper_Uploadimages::pinThumbs($pin), 'href' => WM_Router::pinAction($pin['pin_pin_id']));
}
}
$loged = JO_Session::get('user[user_id]');
/* v2.2 */
$config_enable_follow_private_profile = Helper_Config::get('config_enable_follow_private_profile');
if ($config_enable_follow_private_profile) {
$user_enable_follow = isset($user['enable_follow']) ? $user['enable_follow'] : $user['user_enable_follow'];
} else {
$user_enable_follow = true;
}
/* v2.2 */
return array('template' => 'user_followers', 'row' => isset($user['row']) ? $user['row'] % 2 == 0 : 0, 'loged' => $loged, 'user_id' => $user['user_id'], 'avatars' => Helper_Uploadimages::userAvatars($user), 'fullname' => $user['fullname'], 'location' => $user['location'], 'latest_pins' => $thumbs, 'pins' => $user['pins'], 'boards' => $user['boards'], 'following_user' => $user['following_user'], 'enable_follow_user' => $loged ? $user['user_id'] != $loged && $user_enable_follow : false, 'user_follow_href' => $loged && $user['user_id'] != $loged ? WM_Router::create($request->getBaseUrl() . '?controller=users&action=follow&user_id=' . $user['user_id']) : false, 'user_href' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $user['user_id']), 'pins_href' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=pins&user_id=' . $user['user_id']), 'text_pin_s' => $user['pins'] == 1 ? $this->translate('Pin') : $this->translate('Pins'), 'text_board_s' => $user['boards'] == 1 ? $this->translate('Board') : $this->translate('Boards'), 'text_follow' => $this->translate('Follow'), 'text_unfollow' => $this->translate('Unfollow'));
}
示例3: getPinsAction
public function getPinsAction($return_data = false)
{
$request = $this->getRequest();
$response = $this->getResponse();
$page = (int) $request->getRequest('page');
if ($page < 1) {
$page = 1;
}
$pp = (int) Helper_Config::get('config_front_limit');
if (!(int) $pp) {
$pp = 50;
}
if ((int) $request->getRequest('per_page') > 0 && (int) $request->getRequest('per_page') < 300) {
$pp = (int) $request->getRequest('per_page');
}
$data = array('start' => $pp * $page - $pp, 'limit' => $pp);
$return = array();
//Recent Activity
if ($page == 1 && JO_Session::get('user[user_id]')) {
$history_data = Model_History_Activity::getHistoryV2(array('start' => 0, 'limit' => 10, 'sort' => 'DESC', 'order' => 'history_id'));
$history = array();
foreach ($history_data as $row) {
$user_avatars = Helper_Uploadimages::userAvatars(array('avatar' => $row['user_avatar'], 'store' => $row['user_store'], 'user_id' => $row['user_user_id']));
$haystack_pins = array(Model_History_Abstract::REPIN, Model_History_Abstract::ADDPIN, Model_History_Abstract::COMMENTPIN, Model_History_Abstract::LIKEPIN);
$text = $row['history_text_type'];
$href_pin = false;
/*if( in_array($row['history_history_action'], $haystack_pins) ) {
// if($row['history_history_action'] == Model_History_Abstract::REPIN) {
$href = WM_Router::create($request->getBaseUrl() . '?controller=pin&pin_id=' . $row['history_pin_id']);
} else {*/
$href = WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $row['history_from_user_id']);
if (Model_History_Abstract::REPIN == $row['history_history_action']) {
$text = array($this->translate('repinned your'), $this->translate('pin'), 1);
$href_pin = WM_Router::pinAction($row['history_pin_id']);
} elseif (Model_History_Abstract::LIKEPIN == $row['history_history_action']) {
$text = array($this->translate('like your'), $this->translate('pin'), 1);
$href_pin = WM_Router::pinAction($row['history_pin_id']);
} elseif (Model_History_Abstract::UNLIKEPIN == $row['history_history_action']) {
$text = array($this->translate('unlike your'), $this->translate('pin'), 1);
$href_pin = WM_Router::pinAction($row['history_pin_id']);
} elseif (Model_History_Abstract::COMMENTPIN == $row['history_history_action']) {
$text = array($this->translate('comment your'), $this->translate('pin'), 1);
$href_pin = WM_Router::pinAction($row['history_pin_id']);
} elseif (Model_History_Abstract::FOLLOW == $row['history_history_action']) {
$board_info = new Model_Boards_Board($row['history_board_id']);
if ($board_info->count()) {
$text = array($this->translate('is now following your'), $board_info['board_title']);
$href_pin = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=view&user_id=' . $board_info['board_user_id'] . '&board_id=' . $board_info['board_board_id']);
}
} elseif (Model_History_Abstract::UNFOLLOW == $row['history_history_action']) {
$board_info = new Model_Boards_Board($row['history_board_id']);
if ($board_info->count()) {
$text = array($this->translate('has unfollow your'), $board_info['board_title']);
$href_pin = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=view&user_id=' . $board_info['board_user_id'] . '&board_id=' . $board_info['board_board_id']);
}
}
//}
$history[] = array('history_id' => $row['history_history_id'], 'date_added' => $row['history_date_added'], 'profile' => array('fullname' => $row['user_fullname'], 'avatars' => $user_avatars), 'href' => $href, 'href_pin' => $href_pin, 'text_type' => $text, 'text_date_dif' => sprintf($this->translate('%d %s ago'), $row['history_date_dif']['value'], $this->translate($row['history_date_dif']['key'])));
}
if ($history) {
$return[] = array('template' => 'home_history', 'history' => $history, 'text_title_box' => $this->translate('Recent Activity'));
}
}
// pins data
$pins = new Model_Pins_HomePage($data);
//format response data
$formatObject = new Helper_Format();
if ($pins->count()) {
$banners = Model_Banners::getBanners(new JO_Db_Expr("`controller` = '" . $request->getController() . "' AND position >= '" . (int) $data['start'] . "' AND position <= '" . (int) ($data['start'] + $pp) . "'"));
foreach ($pins->data as $row => $pin) {
///banners
$key = $row + ($pp * $page - $pp);
if (isset($banners[$key]) && $banners[$key]) {
if (($banners_result = $formatObject->fromatListBanners($banners[$key])) !== false) {
$return[] = $banners_result;
}
}
//pins
$return[] = $formatObject->fromatList($pin);
}
} else {
if ($page == 1) {
$message = $this->translate('No pyngs!');
} else {
$message = $this->translate('No more pyngs!');
}
$return[] = $formatObject->fromatListNoResults($message);
}
if ($return_data) {
return $return;
}
$formatObject->responseJsonCallback($return);
$this->noViewRenderer(true);
}
示例4: editAction
public function editAction()
{
// var_dump( htmlspecialchars('⚐') );exit;
$request = $this->getRequest();
$pin_id = $request->getRequest('pin_id');
// $pin_info = Model_Pins::getPin($pin_id);
$pin_info = new Model_Pins_Pin($pin_id);
if (!$pin_info->count() || $pin_info->data['pin_user_id'] != JO_Session::get('user[user_id]')) {
$this->forward('error', 'error404');
}
$pin_info = $pin_info->data;
if ($request->isPost()) {
$validate = new Helper_Validate();
if ($pin_info['pin_from']) {
$validate->_set_rules($request->getPost('from'), $this->translate('Link'), 'not_empty;min_length[3];domain');
} else {
if (trim($request->getPost('from'))) {
$validate->_set_rules($request->getPost('from'), $this->translate('Link'), 'not_empty;min_length[3];domain');
}
}
$data = $request->getPost();
if ($validate->_valid_form()) {
$edit = new Model_Pins_Edit($pin_id, $request->getPost());
$this->redirect(WM_Router::pinAction($pin_info['pin_pin_id']));
} else {
$this->view->error = $validate->_get_error_messages();
}
foreach ($data as $k => $v) {
if (isset($pin_info['pin_' . $k])) {
$pin_info['pin_' . $k] = $v;
}
}
}
$pin_info['images'] = Helper_Uploadimages::pinThumbs($pin_info);
if ($pin_info['pin_gift']) {
$pin_info['price_formated'] = WM_Currency::format($pin_info['pin_price']);
} else {
$pin_info['price_formated'] = '';
$pin_info['pin_price'] = 0;
}
$pin_info['href'] = WM_Router::pinAction($pin_info['pin_pin_id']);
$this->view->pin_info = $pin_info;
$view->get_user_friends = WM_Router::create($request->getBaseUrl() . '?controller=users&action=friends');
$boards = new Model_Boards_BoardsWithShared(array('filter_user_id' => JO_Session::get('user[user_id]')));
$this->view->boards = array();
if ($boards->count()) {
foreach ($boards as $board) {
$this->view->boards[] = array('board_id' => $board['board_board_id'], 'title' => $board['board_title']);
}
}
///////////////// Extension on edit //////////////////
$this->view->form_extensions = array();
$extensions = Model_Extensions::getByMethod('pin_oneditform');
if ($extensions) {
$front = JO_Front::getInstance();
foreach ($extensions as $id => $ext) {
$this->view->form_extensions[] = array('html' => $this->view->callChildren('modules_' . $ext . '_oneditform'), 'view' => $this->view->callChildrenView('modules_' . $ext . '_oneditform'), 'key' => $ext);
}
}
$this->view->pin_delete = WM_Router::pinAction($pin_id, 'delete');
$this->view->children = array('header_part' => 'layout/header_part', 'footer_part' => 'layout/footer_part');
}
示例5: success
private function success()
{
$pin_id = JO_Session::get('success_added');
$this->view->pin_url = WM_Router::pinAction($pin_id);
$this->setViewChange('success');
JO_Session::clear('success_added');
}
示例6: formatPinData
public static function formatPinData($pin, $detail = false)
{
static $model_images = null, $request = null;
if ($model_images === null) {
$model_images = new Helper_Images();
}
if ($request === null) {
$request = JO_Request::getInstance();
}
///////////////////////////////////// PIN INFO /////////////////////////////////////
$pin['pin_id'] = $pin['pin_pin_id'];
$pin['image'] = $pin['pin_image'];
//url's
$pin['pin_url_embed'] = WM_Router::pinAction($pin['pin_pin_id'], 'embed');
if (!JO_Session::get('user[user_id]')) {
$login_url = WM_Router::create($request->getBaseUrl() . '?controller=users&action=login');
if (Helper_Config::get('enable_free_registration')) {
//$login_url = WM_Router::create( $request->getBaseUrl() . '?controller=users&action=register' );
}
$pin['pin_url_email'] = $pin['pin_url_report'] = $pin['pin_url_like'] = $pin['pin_url_repin'] = $pin['pin_url_comment'] = $login_url;
$pin['pin_edit'] = false;
} else {
$pin['pin_url_email'] = WM_Router::pinAction($pin['pin_pin_id'], 'email');
$pin['pin_url_report'] = WM_Router::pinAction($pin['pin_pin_id'], 'report');
$pin['pin_url_like'] = WM_Router::pinAction($pin['pin_pin_id'], 'like');
$pin['pin_url_repin'] = WM_Router::pinAction($pin['pin_pin_id'], 'repin');
$pin['pin_url_comment'] = WM_Router::pinAction($pin['pin_pin_id']);
$pin['pin_edit'] = JO_Session::get('user[user_id]') == $pin['pin_user_id'] ? WM_Router::pinAction($pin['pin_pin_id'], 'edit') : false;
}
//$pin['pin_description'] = self::descriptionFix($pin['pin_description']);
$pin['pin_href'] = WM_Router::pinAction($pin['pin_pin_id']);
if ($pin['pin_gift']) {
$pin['pin_price_formated'] = WM_Currency::format($pin['pin_price']);
} else {
$pin['pin_price_formated'] = 0;
}
//return all image sizes
$pin['pin_thumbs'] = Helper_Uploadimages::pinThumbs($pin);
//array_merge($pin, Helper_Uploadimages::pinThumbs($pin));
$date_dif = array_shift(WM_Date::dateDiff($pin['pin_date_added'], time()));
$pin['pin_date_dif'] = $date_dif;
/* URL'S*/
$pin['pin_onto_href'] = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=view&user_id=' . $pin['board_user_id'] . '&board_id=' . $pin['board_board_id']);
////follow urls
$pin['board_follow_href'] = $pin['user_follow_href'] = $pin['via_follow_href'] = false;
if (JO_Session::get('user[user_id]') ? $pin['board_user_id'] != JO_Session::get('user[user_id]') : false) {
$pin['board_follow_href'] = WM_Router::create($request->getBaseUrl() . '?controller=boards&action=follow&user_id=' . $pin['board_user_id'] . '&board_id=' . $pin['board_board_id']);
}
if (JO_Session::get('user[user_id]') ? $pin['user_user_id'] != JO_Session::get('user[user_id]') : false) {
$pin['user_follow_href'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=follow&user_id=' . $pin['user_user_id']);
}
if ($pin['via_user_id']) {
if (JO_Session::get('user[user_id]') ? $pin['via_user_id'] != JO_Session::get('user[user_id]') : false) {
$pin['via_follow_href'] = WM_Router::create($request->getBaseUrl() . '?controller=users&action=follow&user_id=' . $pin['via_user_id']);
}
} else {
if (JO_Session::get('user[user_id]') ? $pin['user_user_id'] != JO_Session::get('user[user_id]') : false) {
$pin['via_follow_href'] = $pin['user_follow_href'];
}
}
if ($detail) {
$pin['pin_next_href'] = '';
if (isset($pin['pin_next']) && $pin['pin_next']) {
$pin['pin_next_href'] = WM_Router::pinAction($pin['pin_next']);
}
$pin['pin_prev_href'] = '';
if (isset($pin['pin_prev']) && $pin['pin_prev']) {
$pin['pin_prev_href'] = WM_Router::pinAction($pin['pin_prev']);
}
}
if (Helper_Config::get('config_comments_list') && !$detail && $pin['pin_comments']) {
$latest_comments = Model_Comments::getLatestComments2($pin['pin_latest_comments']);
$pin['pin_latest_comments'] = array();
$user_id = JO_Session::get('user[user_id]');
$is_admin = JO_Session::get('user[is_admin]');
$is_developer = JO_Session::get('user[is_developer]');
foreach ($latest_comments as $key => $comment) {
$user_avatars = Helper_Uploadimages::userAvatars(array('avatar' => $comment['avatar'], 'store' => $comment['store'], 'user_id' => $comment['user_id']));
$enable_delete = false;
if ($is_admin) {
$enable_delete = true;
} elseif ($is_developer) {
$enable_delete = true;
} elseif ($user_id == $comment['user_id']) {
$enable_delete = true;
} elseif ($comment['pin_user_id'] == $user_id) {
$enable_delete = true;
}
$delete = false;
if ($enable_delete) {
$delete = WM_Router::create($request->getBaseUrl() . '?controller=pin&action=deleteComment&comment_id=' . $comment['comment_id']);
}
$pin['pin_latest_comments'][] = array('user' => array('profile' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $comment['user_id']), 'avatars' => $user_avatars, 'fullname' => $comment['fullname']), 'comment' => $comment['comment'], 'delete' => $delete);
}
} else {
$pin['pin_latest_comments'] = array();
}
$pin['pin_video_code'] = false;
if ($detail) {
if ($pin['pin_is_video']) {
//.........这里部分代码省略.........
示例7: pinMediaCallbackAction
public function pinMediaCallbackAction()
{
$request = $this->getRequest();
if (JO_Session::get('user[user_id]')) {
$media = Model_Instagram_Media::getMedia($request->getPost('media_id'));
if ($media) {
if ($media['user_id'] == JO_Session::get('user[user_id]')) {
$result = new Model_Pins_Create(array('title' => $media['title'], 'from' => $media['from'], 'image' => $media['media'], 'description' => $media['title'], 'board_id' => JO_Session::get('instagram_media[board_id]')));
if ($result->count()) {
$result = $result->data;
$this->view->pin_url = WM_Router::pinAction($result['pin_id']);
Model_Instagram_Media::setPinMedia($media['media_id'], $result['pin_id']);
///add history
new Model_History_AddHistory(JO_Session::get('user[user_id]'), Model_History_Abstract::ADDPIN, $result['pin_id']);
//send notification
$users = new Model_Users_GroupBoardUsers(JO_Session::get('instagram_media[board_id]'));
if ($users->count()) {
$template = Model_Notification::getTemplate('group_board');
if ($template) {
$pin_info = new Model_Pins_Pin($result['pin_id']);
if ($pin_info->count()) {
$mail_footer = html_entity_decode(Helper_Config::get('mail_footer'), ENT_QUOTES, 'utf-8');
foreach ($users as $user) {
if ($user['email_interval'] == 1 && $user['groups_pin_email']) {
$template_data = array('user_id' => $user['user_id'], 'user_firstname' => $user['firstname'], 'user_lastname' => $user['lastname'], 'user_fullname' => $user['fullname'], 'user_username' => $user['username'], 'author_url' => WM_Router::create($request->getBaseUrl() . '?controller=users&action=profile&user_id=' . $pin_info['user_user_id']), 'author_fullname' => $pin_info['user_fullname'], 'board_url' => WM_Router::create($request->getBaseUrl() . '?controller=boards&action=view&user_id=' . $pin_info['user_user_id'] . '&board_id=' . $pin_info['board_board_id']), 'board_name' => $pin_info['board_title'], 'pin_url' => WM_Router::pinAction($pin_info['pin_pin_id']), 'mail_footer' => $mail_footer);
if (!$template['title']) {
$template['title'] = '${author_fullname} ' . $this->translate('added new pin to a group board');
}
$title = Model_Notification::parseTemplate(html_entity_decode($template['title'], ENT_QUOTES, 'utf-8'), $template_data);
$body = Model_Notification::parseTemplate(html_entity_decode($template['template'], ENT_QUOTES, 'utf-8'), $template_data);
Model_Email::send($user['email'], Helper_Config::get('noreply_mail'), $title, $body);
}
}
}
}
}
$this->view->ok = true;
} else {
$this->view->error = $this->translate('There was a problem with the record. Please try again!');
}
} else {
$this->view->error = $this->translate('Private media!');
}
} else {
$this->view->error = $this->translate('Media not found!');
}
} else {
$this->view->location = WM_Router::create($request->getBaseUrl() . '?controller=users&action=login');
}
echo $this->renderScript('json');
}