当前位置: 首页>>代码示例>>PHP>>正文


PHP gpFiles类代码示例

本文整理汇总了PHP中gpFiles的典型用法代码示例。如果您正苦于以下问题:PHP gpFiles类的具体用法?PHP gpFiles怎么用?PHP gpFiles使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了gpFiles类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: SessionStart

 public function SessionStart()
 {
     common::GetConfig();
     $username = 'phpunit-username';
     $users = gpFiles::Get('_site/users');
     $userinfo = $users[$username];
     $session_id = gpsession::create($userinfo, $username, $sessions);
     $logged_in = gpsession::start($session_id, $sessions);
     self::AssertTrue($logged_in, 'Not Logged In');
 }
开发者ID:jozefkrz,项目名称:gpEasy-CMS,代码行数:10,代码来源:bootstrap.php

示例2: SaveAddonData

 function SaveAddonData()
 {
     $addonData = array();
     while (count($this->addonHistory) > 30) {
         array_shift($this->addonHistory);
     }
     $addonData['history'] = $this->addonHistory;
     $addonData['reviews'] = $this->addonReviews;
     return gpFiles::SaveArray($this->dataFile, 'addonData', $addonData);
 }
开发者ID:rizub4u,项目名称:gpEasy-CMS,代码行数:10,代码来源:admin_addons_tool.php

示例3: SaveContent

 function SaveContent()
 {
     global $langmessage;
     $content =& $_POST['content'];
     gpFiles::cleanText($content);
     $this->config['content'] = $content;
     if ($this->SaveConfig()) {
         message($langmessage['SAVED']);
     } else {
         message($langmessage['OOPS']);
     }
 }
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:12,代码来源:AdminProtect.php

示例4: SaveAddonData

 function SaveAddonData()
 {
     if (!isset($this->dataFile)) {
         trigger_error('dataFile not set');
         return;
     }
     $addonData = array();
     while (count($this->addonHistory) > 30) {
         array_shift($this->addonHistory);
     }
     $addonData['history'] = $this->addonHistory;
     $addonData['reviews'] = $this->addonReviews;
     return gpFiles::SaveData($this->dataFile, 'addonData', $addonData);
 }
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:14,代码来源:admin_addons_tool.php

示例5: saveSettings

 private function saveSettings()
 {
     global $langmessage;
     $this->updateSetting('wysiwygDelay');
     $this->updateBooleanSetting('wysiwygEnabled');
     $this->updateBooleanSetting('markupEscaped');
     $this->updateBooleanSetting('breaksEnabled');
     $this->updateBooleanSetting('urlsLinked');
     if (gpFiles::SaveArray($this->conf, 'settings', $this->settings)) {
         message($langmessage['SAVED']);
         return;
     }
     message($langmessage['OOPS']);
     $this->settings = $_POST;
 }
开发者ID:ppeterka,项目名称:easymark,代码行数:15,代码来源:EasyMarkAdmin.php

示例6: Child

 /**
  * Get The Image
  *
  */
 function Child($title)
 {
     global $dirPrefix;
     $file = gpFiles::PageFile($title);
     $file_sections = $file_stats = array();
     ob_start();
     require $file;
     ob_get_clean();
     if (!is_array($file_sections)) {
         return;
     }
     //get the image
     $content = section_content::Render($file_sections, $title, $file_stats);
     $img_pos = strpos($content, '<img');
     if ($img_pos === false) {
         return;
     }
     $src_pos = strpos($content, 'src=', $img_pos);
     if ($src_pos === false) {
         return;
     }
     $src = substr($content, $src_pos + 4);
     $quote = $src[0];
     if ($quote != '"' && $quote != "'") {
         return;
     }
     $src_pos = strpos($src, $quote, 1);
     $src = substr($src, 1, $src_pos - 1);
     // check for resized image, get original source if img is resized
     if (strpos($src, 'image.php') !== false && strpos($src, 'img=') !== false) {
         $src = $dirPrefix . '/data/_uploaded/' . urldecode(substr($src, strpos($src, 'img=') + 4));
     }
     $thumb_path = common::ThumbnailPath($src);
     $img_pos2 = strpos($content, '>', $img_pos);
     $img = substr($content, $img_pos, $img_pos2 - $img_pos + 1);
     echo '<li>';
     echo '<img src="' . $thumb_path . '"/>';
     //echo $img;
     $label = common::GetLabel($title);
     echo common::Link($title, $label);
     echo '</li>';
 }
开发者ID:GedionChang,项目名称:gpEasy-CMS,代码行数:46,代码来源:Child_Thumbnails.php

示例7: SaveConfig

 function SaveConfig()
 {
     global $langmessage;
     $format = htmlspecialchars($_POST['date_format']);
     if (@date($format)) {
         $this->config['date_format'] = $format;
     }
     $this->config['commenter_website'] = (string) $_POST['commenter_website'];
     if (isset($_POST['comment_captcha'])) {
         $this->config['comment_captcha'] = true;
     } else {
         $this->config['comment_captcha'] = false;
     }
     if (!gpFiles::SaveArray($this->config_file, 'config', $this->config)) {
         message($langmessage['OOPS']);
         return false;
     }
     message($langmessage['SAVED']);
     return true;
 }
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:20,代码来源:EasyComments_Config.php

示例8: Upgrade_234

 /**
  * Update the gp_index, gp_titles and menus so that special pages can be renamed
  *
  */
 function Upgrade_234()
 {
     global $gp_index, $gp_titles, $gp_menu, $config, $dataDir;
     includeFile('tool/gpOutput.php');
     $special_indexes = array();
     $new_index = array();
     $new_titles = array();
     foreach ($gp_index as $title => $index) {
         $info = $gp_titles[$index];
         $type = common::SpecialOrAdmin($title);
         if ($type === 'special') {
             $special_indexes[$index] = strtolower($title);
             $index = strtolower($title);
             $info['type'] = 'special';
             //some older versions didn't maintain this value well
         }
         $new_index[$title] = $index;
         $new_titles[$index] = $info;
     }
     $gp_titles = $new_titles;
     $gp_index = $new_index;
     //update gp_menu
     $gp_menu = $this->FixMenu($gp_menu, $special_indexes);
     //save pages
     if (!admin_tools::SavePagesPHP()) {
         return;
     }
     $config['gpversion'] = '2.3.4';
     admin_tools::SaveConfig();
     //update alt menus
     if (isset($config['menus']) && is_array($config['menus'])) {
         foreach ($config['menus'] as $key => $value) {
             $menu_file = $dataDir . '/data/_menus/' . $key . '.php';
             if (gpFiles::Exists($menu_file)) {
                 $menu = gpOutput::GetMenuArray($key);
                 $menu = $this->FixMenu($menu, $special_indexes);
                 gpFiles::SaveData($menu_file, 'menu', $menu);
             }
         }
     }
 }
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:45,代码来源:upgrade.php

示例9: TitleContent

 /**
  * Return the formatted content of the title
  *
  */
 public function TitleContent($title)
 {
     $file = gpFiles::PageFile($title);
     $file_sections = $file_stats = array();
     ob_start();
     require $file;
     ob_get_clean();
     if (!is_array($file_sections)) {
         return '';
     }
     //prevent infinite loops
     foreach ($file_sections as $key => $val) {
         if ($val['type'] == 'include') {
             unset($file_sections[$key]);
         }
     }
     if (!$file_sections) {
         return '';
     }
     $file_sections = array_values($file_sections);
     return section_content::Render($file_sections, $title, $file_stats);
 }
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:26,代码来源:Child_Thumbnails.php

示例10: CheckPageFiles

 /**
  * Check page files for orphaned data files
  *
  */
 function CheckPageFiles()
 {
     global $dataDir, $gp_index;
     $pages_dir = $dataDir . '/data/_pages';
     $all_files = gpFiles::ReadDir($pages_dir, 'php');
     foreach ($all_files as $key => $file) {
         $all_files[$key] = $pages_dir . '/' . $file . '.php';
     }
     $page_files = array();
     foreach ($gp_index as $slug => $index) {
         $page_files[] = gpFiles::PageFile($slug);
     }
     $diff = array_diff($all_files, $page_files);
     if (!count($diff)) {
         return;
     }
     echo '<h2>Orphaned Data Files</h2>';
     echo '<p>The following data files appear to be orphaned and are most likely no longer needed. Before completely removing these files, we recommend backing them up first.</p>';
     echo '<table class="bordered"><tr><th>File</th></tr>';
     foreach ($diff as $file) {
         echo '<tr><td>' . $file . '</td></tr>';
     }
     echo '</table>';
 }
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:28,代码来源:admin_rm.php

示例11: SearchPage

 function SearchPage($pattern, $title, $index)
 {
     global $gp_menu;
     $full_path = gpFiles::PageFile($title);
     if (!file_exists($full_path)) {
         return;
     }
     //search hidden?
     if (!$this->search_config['search_hidden']) {
         if (!isset($gp_menu[$index])) {
             return;
         }
     }
     include $full_path;
     if (!isset($file_sections) || !is_array($file_sections)) {
         return;
     }
     $content = '';
     foreach ($file_sections as $section) {
         if (!isset($section['content'])) {
             continue;
         }
         if ($section['type'] == 'exec_php') {
             continue;
         }
         $content .= $section['content'] . ' ';
     }
     $this->findString($content, $pattern, $title);
 }
开发者ID:VTAMAGNO,项目名称:gpEasy-CMS,代码行数:29,代码来源:SimpleSearch.php

示例12: RemoteBrowse

 /**
  * Get addon data from gpEasy.com and display to user
  *
  */
 function RemoteBrowse()
 {
     global $langmessage, $config, $dataDir, $gpversion;
     //search options
     if (isset($_GET['search_option'])) {
         $save = true;
         switch ($_GET['search_option']) {
             case 'version':
                 unset($config['search_version']);
                 break;
             case 'noversion':
                 $config['search_version'] = false;
                 break;
             default:
                 $save = false;
                 break;
         }
         if ($save) {
             admin_tools::SaveConfig();
         }
     }
     //make a list of installed addon id's
     $this->installed_ids = array();
     if (isset($config['addons']) && is_array($config['addons'])) {
         foreach ($config['addons'] as $addon_info) {
             if (isset($addon_info['id'])) {
                 $this->installed_ids[] = $addon_info['id'];
             }
         }
     }
     includeFile('tool/RemoteGet.php');
     $orderby = array();
     $orderby['rating_score'] = $langmessage['Highest Rated'];
     $orderby['downloads'] = $langmessage['Most Downloaded'];
     $orderby['modified'] = $langmessage['Recently Updated'];
     $orderby['created'] = $langmessage['Newest'];
     $_GET += array('q' => '');
     $this->searchPage = 0;
     if (isset($_REQUEST['page']) && ctype_digit($_REQUEST['page'])) {
         $this->searchPage = $_REQUEST['page'];
     }
     $this->searchQuery = 'cmd=remote';
     //version specific search
     $search_version = false;
     if (!isset($config['search_version']) || $config['search_version']) {
         $this->searchQuery .= '&ug=' . rawurlencode($gpversion);
         $search_version = true;
     }
     if (!empty($_GET['q'])) {
         $this->searchQuery .= '&q=' . rawurlencode($_GET['q']);
     }
     if (isset($_GET['order']) && isset($orderby[$_GET['order']])) {
         $this->searchOrder = $_GET['order'];
         $this->searchQuery .= '&order=' . rawurlencode($_GET['order']);
     } else {
         reset($orderby);
         $this->searchOrder = key($orderby);
     }
     $slug = 'Special_Addon_Plugins';
     if ($this->config_index == 'themes') {
         $slug = 'Special_Addon_Themes';
     }
     $src = $GLOBALS['addonBrowsePath'] . '/' . $slug . '?' . $this->searchQuery . '&page=' . $this->searchPage;
     //check cache
     $cache_file = $dataDir . '/data/_remote/' . sha1($src) . '.txt';
     $use_cache = false;
     if (file_exists($cache_file) && filemtime($cache_file) + 26100 > time()) {
         $result = file_get_contents($cache_file);
         $use_cache = true;
     } else {
         $result = gpRemoteGet::Get_Successful($src);
     }
     if (!$result) {
         echo '<p>' . $langmessage['Sorry, data not fetched'] . ' (f1)</p>';
         return;
     }
     if (strpos($result, 'a:') !== 0) {
         echo '<p>' . $langmessage['Sorry, data not fetched'] . ' (f2)</p>';
         return;
     }
     $data = unserialize($result);
     if (count($data) == 0) {
         echo '<p>' . $langmessage['Sorry, data not fetched'] . ' (f3)</p>';
         return;
     }
     //save the cache
     if (!$use_cache) {
         gpFiles::Save($cache_file, $result);
     }
     $this->searchMax = $data['max'];
     if (isset($data['per_page']) && $data['per_page']) {
         $this->searchPerPage = $data['per_page'];
     } else {
         $this->searchPerPage = count($data['rows']);
     }
     $this->searchOffset = $this->searchPage * $this->searchPerPage;
//.........这里部分代码省略.........
开发者ID:rizub4u,项目名称:gpEasy-CMS,代码行数:101,代码来源:admin_addon_install.php

示例13: SaveConfig

 /**
  * Save the current configuration
  * If successful, reset the lists and titles variables
  */
 public function SaveConfig($refresh_msg = false)
 {
     global $langmessage;
     if (!gpFiles::SaveArray($this->config_file, 'config', $this->config)) {
         message($langmessage['OOPS']);
         return false;
     }
     $this->lists = $this->config['lists'];
     $this->titles = $this->config['titles'];
     if (count($this->config['langs'])) {
         $this->langs = $this->config['langs'];
     }
     if ($refresh_msg) {
         message($langmessage['SAVED'] . ' ' . $langmessage['REFRESH']);
     } else {
         message($langmessage['SAVED']);
     }
     return true;
 }
开发者ID:Typesetter,项目名称:Multi-Language,代码行数:23,代码来源:Admin.php

示例14: SaveConfig

 /**
  * Save the gpEasy configuration
  * @return bool
  *
  */
 static function SaveConfig()
 {
     global $config, $dataDir;
     if (!is_array($config)) {
         return false;
     }
     if (!isset($config['gpuniq'])) {
         $config['gpuniq'] = common::RandomString(20);
     }
     return gpFiles::SaveData($dataDir . '/data/_site/config.php', 'config', $config);
 }
开发者ID:Bomberus,项目名称:gpEasy-CMS,代码行数:16,代码来源:admin_tools.php

示例15: GetFile

 /**
  * Retreive the data file for the current title and update the data if necessary
  *
  */
 function GetFile()
 {
     $this->file_sections = gpFiles::Get($this->file, 'file_sections');
     $this->meta_data = gpFiles::$last_meta;
     $this->fileModTime = gpFiles::$last_modified;
     $this->file_stats = gpFiles::$last_stats;
     if (count($this->file_sections) == 0) {
         $this->file_sections[0] = array('type' => 'text', 'content' => '<p>Oops, this page no longer has any content.</p>');
     }
 }
开发者ID:jozefkrz,项目名称:gpEasy-CMS,代码行数:14,代码来源:display.php


注:本文中的gpFiles类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。