本文整理汇总了PHP中ipContent函数的典型用法代码示例。如果您正苦于以下问题:PHP ipContent函数的具体用法?PHP ipContent怎么用?PHP ipContent使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ipContent函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
/**
* Execute response and return html response
*
* @return \Ip\Response
*/
public function execute()
{
ipContent()->setBlockContent('main', $this->content);
$layout = $this->getLayout();
if ($layout[0] == '/' || $layout[1] == ':') {
// Check if absolute path: '/' for unix, 'C:' for windows
$viewFile = $layout;
if (!is_file($viewFile)) {
$viewFile = ipThemeFile('main.php');
}
} elseif (strpos($layout, '/') !== false) {
//impresspages path. Eg. Ip/Internal/xxx.php
$viewFile = $layout;
if (!is_file(ipFile($viewFile))) {
$viewFile = ipThemeFile('main.php');
}
} else {
//layout file. Like main.php
$viewFile = ipThemeFile($layout);
if (!is_file($viewFile)) {
$viewFile = ipThemeFile('main.php');
}
}
$content = ipView($viewFile, $this->getLayoutVariables())->render();
$response = new \Ip\Response($content, $this->getHeaders(), $this->getStatusCode());
return $response;
}
示例2: delete
public static function delete($id)
{
ipEvent('ipBeforeLanguageDeleted', array('id' => $id));
ipDb()->delete('language', array('id' => $id));
ipContent()->_invalidateLanguages();
ipEvent('ipLanguageDeleted', array('id' => $id));
}
示例3: getPageId
public static function getPageId()
{
if (!ipContent()->getCurrentPage()) {
return null;
}
return ipContent()->getCurrentPage()->getId();
}
示例4: saveValue
public function saveValue()
{
$request = \Ip\ServiceLocator::request();
$request->mustBePost();
$post = $request->getPost();
if (empty($post['fieldName'])) {
throw new \Exception('Missing required parameter');
}
$fieldName = $post['fieldName'];
if (!isset($post['value'])) {
throw new \Exception('Missing required parameter');
}
$value = $post['value'];
if (!in_array($fieldName, array('websiteTitle', 'websiteEmail')) && !(in_array($fieldName, array('automaticCron', 'cronPassword', 'removeOldRevisions', 'removeOldRevisionsDays', 'removeOldEmails', 'removeOldEmailsDays', 'allowAnonymousUploads', 'trailingSlash')) && ipAdminPermission('Config advanced'))) {
throw new \Exception('Unknown config value');
}
$emailValidator = new \Ip\Form\Validator\Email();
$error = $emailValidator->getError(array('value' => $value), 'value', \Ip\Form::ENVIRONMENT_ADMIN);
if ($fieldName === 'websiteEmail' && $error !== false) {
return $this->returnError($error);
}
if (in_array($fieldName, array('websiteTitle', 'websiteEmail'))) {
if (!isset($post['languageId'])) {
throw new \Exception('Missing required parameter');
}
$languageId = $post['languageId'];
$language = ipContent()->getLanguage($languageId);
ipSetOptionLang('Config.' . $fieldName, $value, $language->getCode());
} else {
ipSetOption('Config.' . $fieldName, $value);
}
return new \Ip\Response\Json(array(1));
}
示例5: sendMailNotification
public static function sendMailNotification($page, $author, $date, $comm, $emailAuthor, $pageTitle = '', $vcode = '')
{
$sendEmail = ipGetOption('Comment.useSeparateEmail');
if (empty($sendEmail)) {
$sendEmail = ipGetOptionLang('Config.websiteEmail');
}
$noUser = '<br /><div>' . __("You are not a registered user, or pehaps you were not logged in when have commented. So, you need to verify " . "your email address before your comment is moderated and published. Please, click on the following link for " . "such a thing: ", "Comments") . '<a href="' . ipHomeUrl() . ipContent()->getCurrentLanguage()->getUrlPath() . 'comments/' . $vcode . '-!' . $emailAuthor . '">' . __('Email verification', 'Comments') . '</a>' . __(" If it doesn't work, please copy and past the following in your web browser: ", "Comments") . "<strong>" . ipHomeUrl() . ipContent()->getCurrentLanguage()->getUrlPath() . "comments/" . $vcode . '-!' . $emailAuthor . '</strong></div><br />';
if (ipUser()->isLoggedIn()) {
$noUser = '';
}
//array can has: 'title', 'content', 'signature', 'footer'.
$contentAdmin = sprintf('<div><strong>' . __('Page', 'Comments') . ':</strong> ' . __($pageTitle, 'Comments') . ' (%s)</div>' . '<div><strong>' . __('Author', 'Comments') . ':</strong> %s - ' . $emailAuthor . '</div>' . '<div><strong>' . __('Date', 'Comments') . ':</strong> %s</div>' . '<div><strong>' . __('Comment', 'Comments') . ':</strong></div>' . '<div><cite class="mail">%s</cite></div>', $page, $author, $date, $comm);
$templateAdmin = array('title' => __('You just received a comment', 'Comments'), 'content' => $contentAdmin, 'signature' => '<h4>' . __('Internal Administration', 'Comments') . '</h4>', 'footer' => '<h4>' . ipGetOptionLang('Config.websiteTitle') . '</h4>');
$contentAuthor = sprintf(__('Your comment has been sent and it is awaiting moderation. Thank you.', 'Comments') . $noUser . '<div><strong>' . __('Page', 'Comments') . ':</strong> ' . __($pageTitle, 'Comments') . ' (%s)</div>' . '<div><strong>' . __('Author', 'Comments') . ':</strong> %s - ' . $emailAuthor . '</div>' . '<div><strong>' . __('Date', 'Comments') . ':</strong> %s</div>' . '<div><strong>' . __('Comment', 'Comments') . ':</strong></div>' . '<div><cite class="mail">%s</cite></div>', $page, $author, $date, $comm);
$templateAuthor = array('title' => __('You just sent a comment', 'Comments'), 'content' => $contentAuthor, 'signature' => '<div>' . __('Kindest regards', 'Comments') . ',</div>', 'footer' => '<h4>' . ipGetOptionLang('Config.websiteTitle') . '</h4>');
/* ipSendEmail ( string $from , string $fromName , string $to ,
string $toName , string $subject , string $content , [ boolean $urgent ] ,
[ boolean $html ] , [ string|array|null $files ] ) */
if (ipGetOption('Comments.informAboutNewComments') == 'Yes') {
//ipSendEmail() Administration
ipSendEmail($sendEmail, __('Site Comment', 'Comments'), $sendEmail, __('Comment Moderation', 'Comments'), __('There is a new comment', 'Comments') . ': ' . __($pageTitle, 'Comments'), ipEmailTemplate($templateAdmin), true, true);
}
if (ipGetOption('Comments.requireEmailConfirmation') == 'Yes') {
//ipSendMail Author
ipSendEmail($sendEmail, ipGetOptionLang('Config.websiteTitle'), $emailAuthor, $author, __('You have just done a comment in our website', 'Comments') . ': ' . __($pageTitle, 'Comments'), ipEmailTemplate($templateAuthor), true, true);
}
}
示例6: render
public function render($doctype, $environment)
{
$languages = ipContent()->getLanguages();
$answer = '';
foreach ($languages as $language) {
$langValue = '';
$fieldValue = $this->getValue();
if (is_array($fieldValue)) {
if (!empty($fieldValue[$language->getCode()])) {
$langValue = $fieldValue[$language->getCode()];
}
}
if (!is_string($langValue)) {
//just in case we have an array or something else incompatible with below code in the database
$langValue = '';
}
$answer .= '
<div class="input-group">
<span class="input-group-addon">' . esc($language->getAbbreviation()) . '</span>
<input ' . $this->getAttributesStr($doctype) . ' class="form-control ' . implode(' ', $this->getClasses()) . '" name="' . escAttr($this->getName() . '[' . $language->getCode() . ']" ') . $this->getValidationAttributesStr($doctype) . ' type="text" value="' . escAttr($langValue) . '" />
</div>
';
}
return $answer;
}
示例7: ipBeforeController
public static function ipBeforeController()
{
$request = \Ip\ServiceLocator::request();
$sessionLifetime = ini_get('session.gc_maxlifetime');
if (!$sessionLifetime) {
$sessionLifetime = 120;
}
if ($sessionLifetime > 30) {
$sessionLifetime = $sessionLifetime - 20;
}
ipAddJsVariable('ipSessionRefresh', $sessionLifetime);
if (ipConfig()->isDebugMode()) {
ipAddJs('Ip/Internal/Core/assets/ipCore/jquery.js', null, 10);
// default, global jQuery
ipAddJs('Ip/Internal/Core/assets/ipCore/console.log.js', null, 10);
ipAddJs('Ip/Internal/Core/assets/ipCore/functions.js');
ipAddJs('Ip/Internal/Core/assets/ipCore/jquery.tools.form.js');
ipAddJs('Ip/Internal/Core/assets/ipCore/form/color.js');
ipAddJs('Ip/Internal/Core/assets/ipCore/form/file.js');
ipAddJs('Ip/Internal/Core/assets/ipCore/form/richtext.js');
ipAddJs('Ip/Internal/Core/assets/ipCore/form/repositoryFile.js');
ipAddJs('Ip/Internal/Core/assets/ipCore/form/url.js');
ipAddJs('Ip/Internal/Core/assets/ipCore/form.js');
ipAddJs('Ip/Internal/Core/assets/ipCore/validator.js');
ipAddJs('Ip/Internal/Core/assets/ipCore/widgets.js');
ipAddJs('Ip/Internal/Core/assets/ipCore/ipCore.js');
} else {
ipAddJs('Ip/Internal/Core/assets/ipCore.min.js', null, 10);
}
//Form init
$validatorTranslations = array('Ip-admin' => static::validatorLocalizationData('Ip-admin'), ipContent()->getCurrentLanguage()->getCode() => static::validatorLocalizationData('Ip'));
ipAddJsVariable('ipValidatorTranslations', $validatorTranslations);
if (ipAdminId() || \Ip\Internal\Admin\Model::isLoginPage() || \Ip\Internal\Admin\Model::isPasswordResetPage()) {
if (ipConfig()->isDebugMode()) {
ipAddJs('Ip/Internal/Core/assets/admin/managementMode.js');
ipAddJs('Ip/Internal/Core/assets/admin/functions.js');
ipAddJs('Ip/Internal/Core/assets/admin/validator.js');
ipAddJs('Ip/Internal/Core/assets/admin/bootstrap/bootstrap.js');
ipAddJs('Ip/Internal/Core/assets/admin/bootstrap-switch/bootstrap-switch.js');
} else {
ipAddJs('Ip/Internal/Core/assets/admin.min.js', null, 10);
}
ipAddJs('Ip/Internal/Core/assets/tinymce/pastePreprocess.js');
ipAddJs('Ip/Internal/Core/assets/tinymce/default.js');
}
if (ipAdminId()) {
ipAddJs('Ip/Internal/Core/assets/js/tiny_mce/jquery.tinymce.min.js');
ipAddJs('Ip/Internal/Core/assets/js/tiny_mce/tinymce.min.js');
ipAddJsVariable('ipBrowseLinkModalTemplate', ipView('view/browseLinkModal.php')->render());
ipAddJs('Ip/Internal/Core/assets/ipCore/plupload/plupload.full.js');
ipAddJs('Ip/Internal/Core/assets/ipCore/plupload/plupload.browserplus.js');
ipAddJs('Ip/Internal/Core/assets/ipCore/plupload/plupload.gears.js');
ipAddJs('Ip/Internal/Core/assets/ipCore/plupload/jquery.plupload.queue/jquery.plupload.queue.js');
if (is_file(ipThemeFile('setup/admin.js'))) {
ipAddJs(ipThemeUrl('setup/admin.js'));
}
ipAddCss('Ip/Internal/Core/assets/admin/admin.css');
}
}
示例8: ipExecuteController
/**
* @param $info
* @return \Ip\Response\Redirect
*/
public static function ipExecuteController($info)
{
$page = ipContent()->getCurrentPage();
if ($page && $page->getRedirectUrl() && !ipAdminId()) {
return new \Ip\Response\Redirect($page->getRedirectUrl());
}
return null;
}
示例9: languageList
public static function languageList()
{
$answer = array();
$languages = ipContent()->getLanguages();
foreach ($languages as $language) {
$answer[] = array('id' => $language->getId(), 'title' => $language->getTitle(), 'abbreviation' => $language->getAbbreviation(), 'code' => $language->getCode());
}
return $answer;
}
示例10: activate
/**
* @throws \Ip\Exception\Db
*/
public function activate()
{
$savedTableTypes = ipGetOption(TableType::OPTION);
if (empty($savedTableTypes)) {
ipSetOption(TableType::OPTION, array());
TableType::create(array('name' => 'default', 'language' => ipContent()->getLanguages()[0]->getId(), 'columnOption' => TableType::SHOW_ALL_COLUMNS, 'specificColumns' => array()))->save();
}
$this->createDataTableRepository();
}
示例11: ipBeforeLanguageDeleted
public static function ipBeforeLanguageDeleted($data)
{
$languageId = $data['id'];
$language = ipContent()->getLanguage($languageId);
$menus = Service::getMenus($language->getCode());
foreach ($menus as $menu) {
Service::deletePage($menu['id']);
}
}
示例12: pageNotFound
public function pageNotFound()
{
$content = null;
$error404Page = ipContent()->getPageByAlias('error404');
if ($error404Page) {
$revision = \Ip\Internal\Revision::getPublishedRevision($error404Page->getId());
$content = \Ip\Internal\Content\Model::generateBlock('main', $revision['revisionId'], 0, 0);
}
return new \Ip\Response\PageNotFound($content);
}
示例13: pagePassword
public static function pagePassword($pageId = null)
{
if ($pageId === null) {
if (!ipContent()->getCurrentPage()) {
return null;
}
$pageId = ipContent()->getCurrentPage()->getId();
}
return Model::getPagePassword($pageId);
}
示例14: index
/**
* @ipSubmenu Table types
*/
public function index()
{
ipAddJs('Ip/Internal/Core/assets/js/angular.js');
ipAddJs('Plugin/DataTableWidget/assets/tableTypesController.js');
$data = array('createForm' => AdminFormHelper::createForm(true), 'updateForm' => AdminFormHelper::updateForm(true), 'deleteForm' => AdminFormHelper::deleteForm());
ipAddJsVariable('tableTypes', TableType::getAllAsArray());
ipAddJsVariable('columnOptions', TableType::getColumnOptions());
ipAddJsVariable('languages', ipContent()->getLanguages());
return ipView('view/layout.php', $data)->render();
}
示例15: ipLanguageAdded
public static function ipLanguageAdded($data)
{
$language = ipContent()->getLanguage($data['id']);
$languages = ipContent()->getLanguages();
$firstLanguage = $languages[0];
$title = ipGetOptionLang('Config.websiteTitle', $firstLanguage->getCode());
$email = ipGetOptionLang('Config.websiteEmail', $firstLanguage->getCode());
ipSetOptionLang('Config.websiteTitle', $title, $language->getCode());
ipSetOptionLang('Config.websiteEmail', $email, $language->getCode());
}