本文整理汇总了PHP中ipGetOption函数的典型用法代码示例。如果您正苦于以下问题:PHP ipGetOption函数的具体用法?PHP ipGetOption怎么用?PHP ipGetOption使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ipGetOption函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addPage
/**
* Insert new page
*
* @param int $parentId
* @param string $title
* @param array $data
* @return int page id
* @throws \Ip\Exception
*/
public static function addPage($parentId, $title, $data = array())
{
$data['title'] = $title;
if (!isset($data['createdAt'])) {
$data['createdAt'] = date('Y-m-d H:i:s');
}
if (!isset($data['updatedAt'])) {
$data['updatedAt'] = date('Y-m-d H:i:s');
}
if (!isset($data['isVisible'])) {
$data['isVisible'] = !ipGetOption('Pages.hideNewPages');
}
if (!isset($data['languageCode'])) {
$data['languageCode'] = ipDb()->selectValue('page', 'languageCode', array('id' => $parentId));
if (empty($data['languageCode'])) {
$data['languageCode'] = ipDb()->selectValue('page', 'languageCode', array('alias' => $parentId));
}
if (empty($data['languageCode'])) {
throw new \Ip\Exception('Page languageCode should be set if parent is absent');
}
}
if (!isset($data['urlPath'])) {
$dataForPath = $data;
$dataForPath['parentId'] = $parentId;
$data['urlPath'] = UrlAllocator::allocatePathForNewPage($dataForPath);
}
$newPageId = Model::addPage($parentId, $data);
return $newPageId;
}
示例2: ipJs
public static function ipJs($jsFiles)
{
if (ipGetOption('ConcatenateJsCss.disableInAdmin', 1) && ipAdminId() || ipStorage()->get('ConcatenateJsCss', 'concatenationInProgress') > time()) {
return $jsFiles;
}
ipStorage()->set('ConcatenateJsCss', 'concatenationInProgress', time() + 60);
//if some CSS / JS links to the website itself, we may have an infinite recursion. So we have to disable ourself during the concatenation
$tinymceUrl = ipFileUrl('Ip/Internal/Core/assets/js/tiny_mce');
$answer = array('concatenateJsCss_tinymce_fix' => array('type' => 'content', 'value' => "var tinyMCEPreInit = {\n suffix: '.min',\n base: '" . $tinymceUrl . "',\n query: ''\n};", 'attributes' => array(), 'cacheFix' => false));
$chunk = array();
foreach ($jsFiles as &$file) {
if ($file['type'] == 'content') {
//we have faced a piece of inline JS. It can't be concatenated. We have to split concatenated JS in to two parts.
if (!empty($chunk)) {
$answer = array_merge($answer, self::concatenateChunk($chunk));
}
$chunk = array();
//add current inline content JS
$answer[] = $file;
} else {
$chunk[] = $file;
}
}
if (!empty($chunk)) {
$answer = array_merge($answer, self::concatenateChunk($chunk));
}
ipStorage()->remove('ConcatenateJsCss', 'concatenationInProgress');
return $answer;
}
示例3: ipBeforeController
public static function ipBeforeController()
{
$style = ipGetOption('Colorbox.style', 1);
ipAddCss('Plugin/Colorbox/assets/theme' . $style . '/colorbox.css');
ipAddJs('Plugin/Colorbox/assets/colorbox/jquery.colorbox-min.js');
ipAddJs('Plugin/Colorbox/assets/colorboxInit.js');
}
示例4: index
public function index()
{
ipAddJsVariable('ipTranslationAreYouSure', __('Are you sure?', 'Ip-admin', false));
ipAddJs('Ip/Internal/Core/assets/js/angular.js');
ipAddJs('Ip/Internal/Pages/assets/js/pages.js');
ipAddJs('Ip/Internal/Pages/assets/js/pagesLayout.js');
ipAddJs('Ip/Internal/Pages/assets/js/menuList.js');
ipAddJs('Ip/Internal/Pages/assets/jstree/jstree.min.js');
ipAddJs('Ip/Internal/Pages/assets/js/jquery.pageTree.js');
ipAddJs('Ip/Internal/Pages/assets/js/jquery.pageProperties.js');
ipAddJs('Ip/Internal/Grid/assets/grid.js');
ipAddJs('Ip/Internal/Grid/assets/gridInit.js');
ipAddJs('Ip/Internal/Grid/assets/subgridField.js');
ipAddJsVariable('languageList', Helper::languageList());
ipAddJsVariable('ipPagesLanguagesPermission', ipAdminPermission('Languages'));
$menus = Model::getMenuList();
foreach ($menus as $key => &$menu) {
$default = 'top';
if ($key == 0) {
$default = 'bottom';
}
$menu['defaultPosition'] = Model::getDefaultMenuPagePosition($menu['alias'], false, $default);
$default = 'below';
$menu['defaultPositionWhenSelected'] = Model::getDefaultMenuPagePosition($menu['alias'], true, $default);
}
$menus = ipFilter('ipPagesMenuList', $menus);
ipAddJsVariable('menuList', $menus);
$variables = array('addPageForm' => Helper::addPageForm(), 'addMenuForm' => Helper::addMenuForm(), 'languagesUrl' => ipConfig()->baseUrl() . '?aa=Languages.index');
$layout = ipView('view/layout.php', $variables);
ipResponse()->setLayoutVariable('removeAdminContentWrapper', true);
ipAddJsVariable('listStylePageSize', ipGetOption('Pages.pageListSize', 30));
return $layout->render();
}
示例5: config
protected function config()
{
$reservedDirs = ipGetOption('Config.reservedDirs');
if (!is_array($reservedDirs)) {
$reservedDirs = array();
}
return array('type' => 'table', 'table' => 'language', 'allowCreate' => false, 'allowSearch' => false, 'actions' => array(array('label' => __('Add', 'Ip-admin', false), 'class' => 'ipsCustomAdd')), 'preventAction' => array($this, 'preventAction'), 'beforeUpdate' => array($this, 'beforeUpdate'), 'afterUpdate' => array($this, 'afterUpdate'), 'beforeDelete' => array($this, 'beforeDelete'), 'deleteWarning' => __('Are you sure you want to delete? All pages and other language related content will be lost forever!', 'Ip-admin', false), 'sortField' => 'languageOrder', 'fields' => array(array('label' => __('Title', 'Ip-admin', false), 'field' => 'title'), array('label' => __('Abbreviation', 'Ip-admin', false), 'field' => 'abbreviation', 'showInList' => true), array('type' => 'Checkbox', 'label' => __('Visible', 'Ip-admin', false), 'field' => 'isVisible'), array('label' => __('Url', 'Ip-admin', false), 'field' => 'url', 'showInList' => false, 'validators' => array(array('Regex', '/^([^\\/\\\\])+$/', __('You can\'t use slash in URL.', 'Ip-admin', false)), array('Unique', array('table' => 'language', 'allowEmpty' => true), __('Language url should be unique', 'Ip-admin', false)), array('NotInArray', $reservedDirs, __('This is a system directory name.', 'Ip-admin', false)))), array('label' => __('RFC 4646 code', 'Ip-admin', false), 'field' => 'code', 'showInList' => false, 'validators' => array(array('Unique', array('table' => 'language'), __('Language code should be unique', 'Ip-admin', false)))), array('type' => 'Select', 'label' => __('Text direction', 'Ip-admin', false), 'field' => 'textDirection', 'showInList' => false, 'values' => array(array('ltr', __('Left To Right', 'Ip-admin', false)), array('rtl', __('Right To Left', 'Ip-admin', false))))));
}
示例6: domain
public static function domain()
{
$domain = ipGetOption('GoogleAnalytics.domain');
if (empty($domain)) {
$domain = parse_url(ipConfig()->baseUrl(), PHP_URL_HOST);
}
return $domain;
}
示例7: ipSendResponse
/**
* @param \Ip\Response $response
* @return mixed
*/
public static function ipSendResponse($response)
{
if (ipGetOption('MaintenanceMode.enabled') == 1 && ipAdminId() === false) {
if (substr(ipRequest()->getRelativePath(), 0, 5) != 'admin') {
return new \Ip\Response(ipGetOption('MaintenanceMode.content'));
}
}
return $response;
}
示例8: AddThis
public static function AddThis($widget = false)
{
if ($widget) {
$layout = ipGetOption('AddThis.widgetLayout');
} else {
$layout = ipGetOption('AddThis.slotLayout');
}
return ipView('view/' . $layout . '.php')->render();
}
示例9: 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();
}
示例10: getAdvancedForm
public static function getAdvancedForm()
{
$form = new \Ip\Form();
$form->addClass('ipsConfigForm');
$form->addClass('ipsConfigFormAdvanced');
$form->addClass('hidden');
$form->setAjaxSubmit(0);
$field = new \Ip\Form\Field\Checkbox(array('name' => 'automaticCron', 'value' => ipGetOption('Config.automaticCron', 1), 'label' => __('Execute cron automatically', 'Ip-admin', false), 'hint' => __('ImpressPages execute cron once every hour on randomly selected visitor page load. I you have setup cron manually, you can disable automatic cron functionality.', 'Ip-admin')));
$field->addClass('ipsAutoSave');
$field->addAttribute('data-fieldid', $field->getName());
$field->addAttribute('id', $field->getName());
$field->addAttribute('data-fieldname', $field->getName());
$form->addField($field);
$field = new \Ip\Form\Field\Text(array('name' => 'cronPassword', 'value' => ipGetOption('Config.cronPassword', 1), 'label' => __('Cron password', 'Ip-admin', false), 'hint' => __('Protect cron from being abusively executed by the strangers.', 'Ip-admin', false), 'note' => '<span class="ipsUrlLabel">' . __('Cron URL: ', 'Ip-admin') . '</span><a target="_blank" class="ipsUrl"></a>'));
$field->addClass('ipsAutoSave');
$field->addAttribute('data-fieldid', $field->getName());
$field->addAttribute('id', $field->getName());
$field->addAttribute('data-fieldname', $field->getName());
$form->addField($field);
$field = new \Ip\Form\Field\Checkbox(array('name' => 'removeOldEmails', 'value' => ipGetOption('Config.removeOldEmails', 0), 'label' => __('Remove old emails from the log', 'Ip-admin', false)));
$field->addClass('ipsAutoSave');
$field->addAttribute('data-fieldid', $field->getName());
$field->addAttribute('id', $field->getName());
$field->addAttribute('data-fieldname', $field->getName());
$form->addField($field);
$field = new \Ip\Form\Field\Text(array('name' => 'removeOldEmailsDays', 'value' => ipGetOption('Config.removeOldEmailsDays', 720), 'label' => __('Days to keep emails', 'Ip-admin', false), 'hint' => __('Meaningful only if "Remove old emails" is on.', 'Ip-admin', false)));
$field->addClass('ipsAutoSave');
$field->addAttribute('data-fieldid', $field->getName());
$field->addAttribute('id', $field->getName());
$field->addAttribute('data-fieldname', $field->getName());
$form->addField($field);
$field = new \Ip\Form\Field\Checkbox(array('name' => 'removeOldRevisions', 'value' => ipGetOption('Config.removeOldRevisions', 0), 'label' => __('Remove old page revisions', 'Ip-admin', false)));
$field->addClass('ipsAutoSave');
$field->addAttribute('data-fieldid', $field->getName());
$field->addAttribute('id', $field->getName());
$field->addAttribute('data-fieldname', $field->getName());
$form->addField($field);
$field = new \Ip\Form\Field\Text(array('name' => 'removeOldRevisionsDays', 'value' => ipGetOption('Config.removeOldRevisionsDays', 720), 'label' => __('Days to keep revisions', 'Ip-admin', false), 'hint' => __('Meaningful only if "Remove old page revisions" is on.', 'Ip-admin', false)));
$field->addClass('ipsAutoSave');
$field->addAttribute('data-fieldid', $field->getName());
$field->addAttribute('id', $field->getName());
$field->addAttribute('data-fieldname', $field->getName());
$form->addField($field);
$field = new \Ip\Form\Field\Checkbox(array('name' => 'allowAnonymousUploads', 'value' => ipGetOption('Config.allowAnonymousUploads', 1), 'label' => __('Allow anonymous uploads', 'Ip-admin', false), 'hint' => __('Disabling this feature will prevent users from uploading files to your website. E.g. in contact forms.', 'Ip-admin')));
$field->addClass('ipsAutoSave');
$field->addAttribute('data-fieldid', $field->getName());
$field->addAttribute('id', $field->getName());
$field->addAttribute('data-fieldname', $field->getName());
$form->addField($field);
$field = new \Ip\Form\Field\Checkbox(array('name' => 'trailingSlash', 'value' => ipGetOption('Config.trailingSlash', 1), 'label' => __('Add trailing slash at the end of page URL', 'Ip-admin', false), 'hint' => __('This won\'t change existing URLs. Only new and updated pages will get slash at the end.', 'Ip-admin')));
$field->addClass('ipsAutoSave');
$field->addAttribute('data-fieldid', $field->getName());
$field->addAttribute('id', $field->getName());
$field->addAttribute('data-fieldname', $field->getName());
$form->addField($field);
return $form;
}
示例11: __construct
/**
* @param int $width width of area where image should fit
* @param int $quality image quoality from 0 to 100
* @param bool $forced if true, and supplied image has different proportions, resulting image will have white edges to make image exactly $Width x $height
*/
public function __construct($width, $quality = null, $forced = false)
{
if ($quality === null) {
$quality = ipGetOption('Config.defaultImageQuality');
}
$this->width = $width;
$this->quality = (int) $quality;
$this->forced = $forced;
}
示例12: ipBeforeController
public static function ipBeforeController()
{
$pubId = ipGetOption('AddThis.addThisUid');
if ($pubId) {
$data['pubid'] = $pubId;
// AddThis publisher ID, if applicable
}
$data['data_track_addressbar'] = true;
ipAddJsVariable("addthis_config", $data);
ipAddJs('http://s7.addthis.com/js/300/addthis_widget.js');
}
示例13: ipPagePropertiesForm
public static function ipPagePropertiesForm($form, $info)
{
if (ipGetOption('Keywordlist.useMetadata') == 0) {
$current = Model::getPageKey($info['pageId']);
$fieldset = new \Ip\Form\Fieldset(__('Keywordlist', 'Keywordlist', false));
$form->addFieldset($fieldset);
$form->addField(new \Ip\Form\Field\Text(array('name' => 'keywordlist', 'label' => __('Keywords', 'Keywordlist', false), 'value' => $current['keywords'], 'note' => __('One or more keywords (commaseparated) wich are related to current page.', 'Keywordlist', false))));
$form->addField(new \Ip\Form\Field\Textarea(array('name' => 'pagedescription', 'label' => __('Description', 'Keywordlist', false), 'value' => $current['description'], 'note' => __('Short description of current page.', 'Keywordlist', false))));
}
return $form;
}
示例14: ipSendResponse
public static function ipSendResponse($response)
{
$enableAdmin = ipGetOption('AnyScript.enableInAdmin', 0);
if ($enableAdmin && ipRoute()->isAdmin() || !ipRoute()->isAdmin()) {
$anyJavascript = ipGetOption('AnyScript.anyJavascript');
$anyCss = ipGetOption('AnyScript.anyCss');
ipAddJsContent("anyJavascript", $anyJavascript);
ipAddJsContent("anyCss", '$("head").append("<style>' . preg_replace('/\\s+/', ' ', trim($anyCss)) . '</style>");');
}
return $response;
}
示例15: getOptionLang
/**
* Get language specific option value
* @param string $key Option key
* @param string $languageCode Language code
* @param null $defaultValue A value to return if the option is not set
* @return string Option value
* @throws Exception
*/
public function getOptionLang($key, $languageCode, $defaultValue = null)
{
$parts = explode('.', $key, 2);
if (!isset($parts[1])) {
throw new \Ip\Exception("Option key must have plugin name separated by dot.");
}
$answer = \Ip\ServiceLocator::storage()->get('Config', $parts[0] . '.' . $languageCode . '.' . $parts[1]);
if ($answer === null) {
$answer = ipGetOption($key, $defaultValue);
}
return $answer;
}