本文整理汇总了PHP中CrowdfundingHelperRoute::getEmbedRoute方法的典型用法代码示例。如果您正苦于以下问题:PHP CrowdfundingHelperRoute::getEmbedRoute方法的具体用法?PHP CrowdfundingHelperRoute::getEmbedRoute怎么用?PHP CrowdfundingHelperRoute::getEmbedRoute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CrowdfundingHelperRoute
的用法示例。
在下文中一共展示了CrowdfundingHelperRoute::getEmbedRoute方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: send
public function send()
{
// Check for request forgeries.
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
$redirectOptions = array("view" => "discover");
$params = JComponentHelper::getParams("com_crowdfunding");
/** @var $params Joomla\Registry\Registry */
if (!$params->get("security_display_friend_form", 0)) {
$this->displayNotice(JText::_('COM_CROWDFUNDING_ERROR_CANT_SEND_MAIL'), $redirectOptions);
return;
}
// Get the data from the form POST
$data = $this->input->post->get('jform', array(), 'array');
$itemId = Joomla\Utilities\ArrayHelper::getValue($data, "id", 0, "uint");
// Get project
$item = Crowdfunding\Project::getInstance(JFactory::getDbo(), $itemId);
// Prepare redirect link
$link = CrowdfundingHelperRoute::getEmbedRoute($item->getSlug(), $item->getCatSlug(), "email");
$redirectOptions = array("force_direction" => $link);
$model = $this->getModel();
/** @var $model CrowdfundingModelFriendMail */
$form = $model->getForm($data, false);
/** @var $form JForm */
if (!$form) {
throw new Exception(JText::_("COM_CROWDFUNDING_ERROR_FORM_CANNOT_BE_LOADED"));
}
// Test if the data is valid.
$validData = $model->validate($form, $data);
// Check for validation errors.
if ($validData === false) {
$this->displayNotice($form->getErrors(), $redirectOptions);
return;
}
try {
$model->send($validData);
} catch (Exception $e) {
JLog::add($e->getMessage());
throw new Exception(JText::_('COM_CROWDFUNDING_ERROR_SYSTEM'));
}
// Redirect to next page
$this->displayMessage(JText::_("COM_CROWDFUNDING_FRIEND_MAIL_SUCCESSFULLY_SEND"), $redirectOptions);
}
示例2: getEmbeded
/**
* @param object $item
* @param Joomla\Registry\Registry $params
* @param string $url
*
* @return string
*/
private function getEmbeded($item, $params, $url)
{
$html = "";
if (!$params->get("display_embed_link", 1) and !$params->get("display_embed_button", 1) and !$params->get("display_embed_email", 1)) {
return $html;
}
$html = '<div class="clearfix"></div>';
$html .= '<div class="crowdf-embeded">';
if ($params->get("display_embed_link", 1)) {
$html .= '<input type="text" name="share_url" value="' . html_entity_decode($url, ENT_COMPAT, 'UTF-8') . '" class="crowdf-embeded-input" />';
}
if ($params->get("display_embed_button", 1)) {
$link = JRoute::_(CrowdfundingHelperRoute::getEmbedRoute($item->slug, $item->catslug), false);
$html .= '<a href="' . $link . '" class="btn btn-default" role="button"><span class="glyphicon glyphicon-th-large"></span> ' . JText::_("PLG_CONTENT_CROWDFUNDINGSOCIALSHARE_EMBED") . '</a>';
}
if ($params->get("display_embed_email", 1)) {
$link = JRoute::_(CrowdfundingHelperRoute::getEmbedRoute($item->slug, $item->catslug, "email"), false);
$html .= '<a class="btn btn-default" href="' . $link . '" role="button"><span class="glyphicon glyphicon-envelope"></span> ' . JText::_("PLG_CONTENT_CROWDFUNDINGSOCIALSHARE_EMAIL") . '</a>';
}
if ($params->get("display_follow", 0)) {
$userId = JFactory::getUser()->get("id");
$state = Prism\Constants::UNFOLLOWED;
$projectId = (int) $item->id;
$text = JText::_("PLG_CONTENT_CROWDFUNDINGSOCIALSHARE_FOLLOW");
$class = " btn-default";
// Load scripts.
JHtml::_('jquery.framework');
$doc = JFactory::getDocument();
$doc->addScript(JUri::root() . "plugins/content/crowdfundingsocialshare/script.js");
if ($userId) {
$user = new Crowdfunding\User\User(JFactory::getDbo());
$user->setId($userId);
$followed = $user->getFollowed();
if (in_array($projectId, $followed)) {
$state = Prism\Constants::FOLLOWED;
$text = JText::_("PLG_CONTENT_CROWDFUNDINGSOCIALSHARE_FOLLOWING");
$class = " btn-primary";
}
JText::script('PLG_CONTENT_CROWDFUNDINGSOCIALSHARE_FOLLOW');
JText::script('PLG_CONTENT_CROWDFUNDINGSOCIALSHARE_UNFOLLOW');
JText::script('PLG_CONTENT_CROWDFUNDINGSOCIALSHARE_FOLLOWING');
}
$html .= '<a href="javascript: void(0);" class="btn ' . $class . '" id="js-plgsocialshare-btn-follow" role="button" data-uid="' . (int) $userId . '" data-state="' . (int) $state . '" data-pid="' . $projectId . '">
<span class="glyphicon glyphicon-heart"></span>
<span id="js-plgsocialshare-btn-text">' . $text . '</span></a>';
}
$html .= '</div>';
return $html;
}
示例3: prepareEmbedCode
/**
* Generate HTML code for embeding.
*
* @param stdclass $item
* @param string $host
*
* @return string
*/
protected function prepareEmbedCode($item, $host)
{
// Generate embed link
$embedLink = $host . JRoute::_(CrowdfundingHelperRoute::getEmbedRoute($item->slug, $item->catslug) . '&layout=widget&tmpl=component', false);
return '<iframe src="' . $embedLink . '"" width="280px" height="560px" frameborder="0" scrolling="no"></iframe>';
}