本文整理汇总了PHP中ipFileUrl函数的典型用法代码示例。如果您正苦于以下问题:PHP ipFileUrl函数的具体用法?PHP ipFileUrl怎么用?PHP ipFileUrl使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ipFileUrl函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getList
/**
* @param string $languageCode
* @param int $parentId
* @return array
*/
protected static function getList($languageCode, $parentId)
{
$pages = ipDb()->selectAll('page', '*', array('parentId' => $parentId, 'isDeleted' => 0), 'ORDER BY `pageOrder`');
$answer = array();
//generate jsTree response array
foreach ($pages as $page) {
$pageData = array();
$pageData['state'] = 'closed';
$jsTreeId = 'page_' . $page['id'];
if (!empty($_SESSION['Pages.nodeOpen'][$jsTreeId])) {
$pageData['state'] = 'open';
}
$children = self::getList($languageCode, $page['id']);
if (count($children) === 0) {
$pageData['children'] = false;
$pageData['state'] = 'leaf';
}
$pageData['children'] = $children;
if ($page['isVisible']) {
$icon = '';
} else {
$icon = ipFileUrl('Ip/Internal/Pages/assets/img/file_hidden.png');
}
$pageData['li_attr'] = array('id' => $jsTreeId, 'rel' => 'page', 'languageId' => $languageCode, 'pageId' => $page['id']);
$pageData['data'] = array('title' => $page['title'] . '', 'icon' => $icon);
//transform null into empty string. Null break JStree into infinite loop
$pageData['text'] = htmlspecialchars($page['title']);
$answer[] = $pageData;
}
return $answer;
}
示例2: generateManagedImage
public function generateManagedImage($key, $defaultValue = null, $options = array(), $cssClass = null)
{
$defaultPlaceholder = ipFileUrl('Ip/Internal/InlineManagement/assets/empty.gif');
if (isset($options['languageId'])) {
$languageId = $options['languageId'];
} else {
$languageId = ipContent()->getCurrentLanguage()->getId();
}
if (isset($options['pageId'])) {
$pageId = $options['pageId'];
} else {
if (ipContent()->getCurrentPage()) {
$pageId = ipContent()->getCurrentPage()->getId();
} else {
$pageId = null;
}
}
// if default value is not defined, we'll add it
if (empty($defaultValue)) {
$defaultValue = $defaultPlaceholder;
}
$imageStr = $this->dao->getValue(Dao::PREFIX_IMAGE, $key, $languageId, $pageId);
$image = new Entity\Image($imageStr, $defaultValue);
$data = array('value' => $image->getImage(), 'defaultValue' => $defaultValue, 'empty' => $image->getImage() == '' || $image->getImage() == $defaultPlaceholder, 'key' => $key, 'options' => $options, 'cssClass' => $cssClass);
if (ipIsManagementState()) {
$view = ipView('view/management/image.php', $data);
} else {
$view = ipView('view/display/image.php', $data);
}
return $view->render();
}
示例3: __construct
/**
* @param array|string $data
* @param null $defaultImage
*/
public function __construct($data, $defaultImage = null)
{
if (is_string($data)) {
$data = $this->parseStr($data);
}
if (!empty($data['imageOrig']) && file_exists(ipFile('file/repository/' . $data['imageOrig']))) {
$this->imageOrig = $data['imageOrig'];
if (isset($data['x1']) && isset($data['y1']) && isset($data['x2']) && isset($data['y2'])) {
$this->x1 = $data['x1'];
$this->y1 = $data['y1'];
$this->x2 = $data['x2'];
$this->y2 = $data['y2'];
if (empty($data['requiredWidth'])) {
$data['requiredWidth'] = $this->x2 - $this->x1;
}
if (empty($data['requiredHeight'])) {
$data['requiredHeight'] = $this->y2 - $this->y1;
}
$this->requiredWidth = $data['requiredWidth'];
$this->requiredHeight = $data['requiredHeight'];
$transform = array('type' => 'crop', 'x1' => $this->getX1(), 'y1' => $this->getY1(), 'x2' => $this->getX2(), 'y2' => $this->getY2(), 'width' => $this->getRequiredWidth(), 'height' => $this->getRequiredHeight());
$this->image = ipFileUrl(ipReflection($this->getImageOrig(), $transform, null));
}
} else {
$this->image = $defaultImage;
}
if (!empty($data['id'])) {
$this->id = $data['id'];
} else {
$this->id = mt_rand(2, 2147483647);
//1 used for inline logo
}
}
示例4: ipHead
public static function ipHead($head)
{
$vars = array('siteName' => ipGetOptionLang('Config.websiteTitle'));
$defaultTitle = ipGetOptionLang('FacebookTags.defaultTitle');
if ($defaultTitle) {
$vars['title'] = $defaultTitle;
}
$defaultImage = array(ipGetOptionLang('FacebookTags.defaultImage'));
if ($defaultImage) {
$vars['images'] = $defaultImage;
}
$adminId = ipGetOptionLang('FacebookTags.adminId');
if ($adminId) {
$vars['adminId'] = $adminId;
}
$pageTags = Service::facebookTags();
if (!empty($pageTags['images'])) {
foreach ($pageTags['images'] as &$image) {
$image = ipFileUrl('file/repository/' . $image);
}
} else {
unset($pageTags['images']);
}
$vars = array_merge($vars, $pageTags);
$tags = ipView('view/tags.php', $vars)->render();
$head .= $tags;
return $head;
}
示例5: concatenate
protected static function concatenate($urls, $ext)
{
$key = md5(json_encode($urls));
$path = 'file/concatenate/' . $key . '.' . $ext;
if (!is_file(ipFile($path))) {
$concatenated = '';
foreach ($urls as $url) {
$urlContent = self::fetchContent($url);
if ($urlContent === false) {
//break if at least one of the assets can't be downloaded
return false;
}
if ($ext == 'css') {
$urlContent = self::replaceUrls($url, $urlContent);
$concatenated .= "\n" . '/*' . $url . "*/\n" . $urlContent;
}
if ($ext == 'js') {
$urlContent .= ';';
$concatenated .= "\n" . '//' . $url . "\n" . $urlContent;
}
}
if (!is_dir(ipFile('file/concatenate'))) {
mkdir(ipFile('file/concatenate'));
}
file_put_contents(ipFile($path), $concatenated);
}
return ipFileUrl($path);
}
示例6: 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;
}
示例7: pluginIcon
protected function pluginIcon($pluginName)
{
if (file_exists(ipFile('Plugin/' . $pluginName . '/assets/icon.svg'))) {
return ipFileUrl('Plugin/' . $pluginName . '/assets/icon.svg');
}
if (file_exists(ipFile('Plugin/' . $pluginName . '/assets/icon.png'))) {
return ipFileUrl('Plugin/' . $pluginName . '/assets/icon.png');
}
}
示例8: showImage
public static function showImage($value, $recordData = null)
{
if ($value) {
$transform = array('type' => 'fit', 'width' => 100, 'height' => 100);
$thumbnailUrl = ipReflection($value, $transform, 'preview.jpg');
$imageHtml = '<a href="' . ipFileUrl('file/repository/' . $value) . '" target="blank"><img src="' . $thumbnailUrl . '" alt="' . esc($value) . '"></a>';
return $imageHtml;
} else {
return false;
}
}
示例9: getThumbnailUrl
public function getThumbnailUrl()
{
if ($this->thumbnail) {
if ($this->url) {
$image = $this->url . $this->name . '/' . Model::INSTALL_DIR . $this->thumbnail;
} else {
$image = ipFileUrl('Theme/' . $this->name . '/' . Model::INSTALL_DIR . $this->thumbnail);
}
} else {
$image = ipFileUrl('Ip/Internal/Design/assets/theme.png');
}
return $image;
}
示例10: render
/**
* Render field
*
* @param string $doctype
* @param $environment
* @return string
*/
public function render($doctype, $environment)
{
$captcha = new \Ip\Lib\HnCaptcha\HnCaptcha($this->captchaInit, true);
$captcha->make_captcha();
$_SESSION['developer']['form']['field']['captcha'][$this->getId()]['public_key'] = $captcha->public_key;
return '
<div class="captcha">
<input ' . $this->getAttributesStr($doctype) . ' class="form-control ' . implode(' ', $this->getClasses()) . '" name="' . htmlspecialchars($this->getName()) . '[code]" ' . $this->getValidationAttributesStr($doctype) . ' type="text" />
<input type="hidden" name="' . htmlspecialchars($this->getName()) . '[id]" value="' . $this->getId() . '" />
<img src="' . ipFileUrl($captcha->get_filename_url()) . '" alt="Captcha"/>
</div>
';
}
示例11: ipBeforeController
public static function ipBeforeController()
{
$configModel = ConfigModel::instance();
if ($configModel->isInPreviewState()) {
ipAddJsVariable('ipRepositoryUrl', ipFileUrl('file/repository/'));
static::initConfig();
}
$lessCompiler = LessCompiler::instance();
if (ipConfig()->isDevelopmentEnvironment()) {
if ($lessCompiler->shouldRebuild(ipConfig()->theme())) {
$lessCompiler->rebuild(ipConfig()->theme());
}
}
}
示例12: img
function img($varname, $default, $width, $height, $class = '', $tagname = 'img')
{
$varname = $this->num != -1 ? $varname . '-' . $this->num : $varname;
$defaultval = ipThemeUrl('assets/') . $default;
if (array_key_exists($varname, $this->data)) {
$fileName = $this->data[$varname]['fileName'];
$transform = array('type' => 'crop', 'x1' => $this->data[$varname]['crop']['x1'], 'y1' => $this->data[$varname]['crop']['y1'], 'x2' => $this->data[$varname]['crop']['x2'], 'y2' => $this->data[$varname]['crop']['y2'], 'width' => $width, 'height' => $height);
$url = ipFileUrl(ipReflection($fileName, $transform, $fileName));
$imgdata = escAttr(json_encode($this->data[$varname]));
} else {
$url = $defaultval;
$imgdata = "";
}
return "<{$tagname} class=\"ipsEditable {$class}\" data-type=\"Image\" data-varname=\"{$varname}\"\n\t\t\t\t\tdata-cssclass=\"{$class}\" data-image=\"{$imgdata}\" src=\"{$url}\"/>";
}
示例13: bkgImage
public static function bkgImage($data)
{
$imageFiles = Service::pageImages();
$images = array();
foreach ($imageFiles as $image) {
$file = $image;
$options = array('type' => 'copy');
$copiedImage = ipReflection($file, $options);
if (!$copiedImage) {
echo ipReflectionException();
} else {
$images[] = ipFileUrl($copiedImage);
}
}
$answer = ipView('view/slot2.php', array('images' => $images))->render();
return $answer;
}
示例14: generateHtml
public function generateHtml($revisionId, $widgetId, $data, $skin)
{
if (empty($data['files']) || !is_array($data['files'])) {
$data['files'] = array();
}
$newData = array();
foreach ($data['files'] as $file) {
if (!isset($file['fileName'])) {
continue;
}
$newFile = array();
$newFile['url'] = ipFileUrl('file/repository/' . $file['fileName']);
$newFile['path'] = ipFile('file/repository/' . $file['fileName']);
$newFile['title'] = isset($file['title']) ? $file['title'] : $file['fileName'];
$newData['files'][] = $newFile;
}
return parent::generateHtml($revisionId, $widgetId, $newData, $skin);
}
示例15: generateHtml
public function generateHtml($revisionId, $widgetId, $data, $skin)
{
$items = Model::widgetItems($widgetId);
// If it has not been configured yet, sets some default values
if (empty($data['options'])) {
$data['options'] = array('gutter' => 10, 'columnWidth' => 320, 'isFitWidth' => true, 'isOriginLeft' => true);
}
$image_options = array('type' => 'width', 'width' => $data['options']['columnWidth'] - 10);
foreach ($items as $key => $item) {
// Clean Up the URL
$link = '';
if ($item['url'] != '') {
$protocol = parse_url($item['url'], PHP_URL_SCHEME);
$target = '_self';
$base_url = ipConfig()->baseUrl();
// If it is an absolute URL don't make any transformation
if ($protocol == 'http' or $protocol == 'https') {
$link = $item['url'];
// If the URL is pointing to another domain, open in a new page.
if (strpos($link, $base_url) === false) {
$target = '_blank';
}
} else {
// Asume it is a reference to a local page
$link = ipFileUrl($item['url']);
}
$items[$key]['link_target'] = $target;
}
$items[$key]['clean_url'] = $link;
// Create Image path
$items[$key]['image_url'] = ipFileUrl(ipReflection($item['image'], $image_options));
}
$data['container_id'] = "masonry_wd_{$widgetId}";
$data['widgetId'] = $widgetId;
$data['items'] = $items;
return parent::generateHtml($revisionId, $widgetId, $data, $skin);
}