/** * Get entries as Moblog * * @access public * @return mixed Returns an array of phoo entries in moblog format and Jaws_Error on error */ function GetMoblog($album) { $table = Jaws_ORM::getInstance()->table('phoo_image_album'); $table->select('phoo_album_id', 'filename', 'phoo_image.id', 'phoo_image.title', 'phoo_image.description', 'phoo_image.createtime'); $table->join('phoo_image', 'phoo_image.id', 'phoo_image_album.phoo_image_id'); $table->join('phoo_album', 'phoo_album.id', 'phoo_image_album.phoo_album_id'); $table->where('phoo_image.published', true)->and(); $table->where('phoo_album.id', $album); $table->orderBy('phoo_image.createtime desc'); $limit = $this->gadget->registry->fetch('moblog_limit'); if (Jaws_Error::isError($limit)) { return new Jaws_Error(_t('PHOO_ERROR_GETMOBLOG')); } $result = $table->limit($limit)->fetchAll(); if (Jaws_Error::IsError($result)) { return new Jaws_Error(_t('PHOO_ERROR_GETMOBLOG')); } foreach ($result as $key => $image) { $result[$key]['name'] = $image['title']; $result[$key]['thumb'] = $this->GetThumbPath($image['filename']); $result[$key]['medium'] = $this->GetMediumPath($image['filename']); $result[$key]['image'] = $this->GetOriginalPath($image['filename']); $result[$key]['stripped_description'] = $image['description']; } return $result; }
/** * Gets gravatar avatar address * * @access public * @param string $email Email address * @param int $size Avatar size * @return string Avatar image address */ static function GetGravatar($email = '', $size = 48) { $theme = $GLOBALS['app']->GetTheme(); if (file_exists($theme['path'] . 'default_avatar.png')) { $defaultImage = $theme['url'] . 'default_avatar.png'; } else { $defaultImage = "gadgets/Users/Resources/images/photo{$size}px.png"; } if (empty($email) || $GLOBALS['app']->Registry->fetch('use_gravatar', 'Settings') == 'no') { return $defaultImage; } $id = md5($email); $rating = $GLOBALS['app']->Registry->fetch('gravatar_rating', 'Settings'); if (Jaws_Error::isError($rating)) { $rating = 'g'; } if ($size > 128) { $size = 128; } elseif ($size < 0) { $size = 0; } $defaultImage = urlencode($GLOBALS['app']->getSiteURL('/' . $defaultImage)); $gravatar = 'http://www.gravatar.com/avatar/' . md5(strtolower(trim($email))); $gravatar .= '?d=' . $defaultImage . '&r=' . $rating . '&s=' . $size; return $gravatar; }
/** * Validates any data provided to the stage. * * @access public * @return bool|Jaws_Error Returns either true on success, or a Jaws_Error * containing the reason for failure. */ function Validate() { if ($_SESSION['install']['predefined']) { return true; } $request = Jaws_Request::getInstance(); $postReq = $request->fetch(array('secure', 'customize'), 'post'); $_SESSION['secure'] = !empty($postReq['secure']); $_SESSION['customize'] = !empty($postReq['customize']); // try to entering to secure transformation mode if ($_SESSION['secure'] && (!isset($_SESSION['pub_key']) || empty($_SESSION['pub_key']))) { require_once JAWS_PATH . 'include/Jaws/Crypt.php'; $pkey = Jaws_Crypt::Generate_RSA_KeyPair(512); if (!Jaws_Error::isError($pkey)) { $_SESSION['pub_key'] = $pkey['pub_key']; $_SESSION['pvt_key'] = $pkey['pvt_key']; } else { return new Jaws_Error(_t('INSTALL_AUTH_ERROR_RSA_KEY_GENERATION'), 0, JAWS_ERROR_WARNING); } } $key_file = INSTALL_PATH . 'key.txt'; if (file_exists($key_file)) { $key = trim(file_get_contents($key_file)); if ($key === $_SESSION['install']['Authentication']['key']) { _log(JAWS_LOG_DEBUG, "Input log and session key match"); return true; } _log(JAWS_LOG_DEBUG, "The key found doesn't match the one below, please check that you entered the key correctly"); return new Jaws_Error(_t('INSTALL_AUTH_ERROR_KEY_MATCH', 'key.txt'), 0, JAWS_ERROR_WARNING); } _log(JAWS_LOG_DEBUG, "Your key file was not found, please make sure you created it, and the web server is able to read it."); return new Jaws_Error(_t('INSTALL_AUTH_ERROR_KEY_FILE', 'key.txt'), 0, JAWS_ERROR_WARNING); }
/** * Returns a list of forums at a request level * * @access public * @param int $gid Group ID * @param bool $onlyPublished * @param bool $last_topic_detail * @return mixed Array with all the available forums or Jaws_Error on error */ function GetForums($gid = false, $onlyAccessible = true, $onlyPublished = false, $last_topic_detail = false) { $table = Jaws_ORM::getInstance()->table('forums'); if ($last_topic_detail) { $table->select('forums.id:integer', 'forums.title', 'forums.description', 'forums.fast_url', 'topics:integer', 'posts:integer', 'last_topic_id:integer', 'forums_topics.last_post_time', 'forums_topics.replies:integer', 'users.username', 'users.nickname', 'forums.locked:boolean', 'forums.published:boolean'); $table->join('forums_topics', 'forums.last_topic_id', 'forums_topics.id', 'left'); $table->join('users', 'forums_topics.last_post_uid', 'users.id', 'left'); } else { $table->select('id:integer', 'title', 'description', 'fast_url', 'topics:integer', 'posts:integer', 'locked:boolean', 'published:boolean', 'gid:integer'); } if (!empty($gid)) { $table->and()->where('gid', $gid); } if ($onlyPublished) { $table->and()->where('forums.published', true); } $result = $table->orderBy('forums.order asc')->fetchAll(); if (Jaws_Error::isError($result)) { return array(); } $forums = array(); foreach ($result as $forum) { if ($this->gadget->GetPermission('ForumPublic', $forum['id'])) { $forums[] = $forum; } } return $forums; }
/** * Show online users list * * @access public * @return string XHTML template content */ function OnlineUsers() { // Load the template $tpl = $this->gadget->template->load('Statistics.html'); $tpl->SetBlock('OnlineUsers'); $tpl->SetVariable('title', _t('USERS_ACTIONS_ONLINEUSERS')); $uniqueOnline = array(); $sessions = $GLOBALS['app']->Session->GetSessions(); if (!Jaws_Error::isError($sessions)) { foreach ($sessions as $session) { if (!empty($session['username'])) { $tpl->SetBlock('OnlineUsers/user'); if (!array_key_exists($session['user'], $uniqueOnline)) { $uniqueOnline[$session['user']] = true; $tpl->SetVariable('username', $session['username']); $tpl->SetVariable('nickname', $session['nickname']); $tpl->SetVariable('url_user', $this->gadget->urlMap('Profile', array('user' => $session['username']))); $tpl->ParseBlock('OnlineUsers/user'); } } } } if (empty($uniqueOnline)) { $tpl->SetBlock('OnlineUsers/no_online'); $tpl->SetVariable('no_online', _t('USERS_ONLINE_NO_ONLINE')); $tpl->ParseBlock('OnlineUsers/no_online'); } $tpl->ParseBlock('OnlineUsers'); return $tpl->Get(); }
/** * Send data to parent site * * @access public * @return boolean */ function SiteActivity() { // Load the template $tpl = $this->gadget->template->load('SiteActivity.html'); $tpl->SetBlock('SiteActivity'); $tpl->SetVariable('title', _t('SITEACTIVITY_ACTIONS_SITEACTIVITY')); $this->SetTitle(_t('SITEACTIVITY_ACTIONS_SITEACTIVITY')); $model = $this->gadget->model->load('SiteActivity'); $filters = array(); $today = getdate(); $todayTime = mktime(0, 0, 0, $today['mon'], $today['mday'], $today['year']); $filters['domain'] = '-1'; // fetch just own domain data $filters['from_date'] = $todayTime; // fetch today data $activities = $model->GetSiteActivities($filters); if (!Jaws_Error::isError($activities) && !empty($activities)) { $gadgetsActivities = array(); $gadget = ''; foreach ($activities as $activity) { if ($activity['gadget'] != $gadget) { $gadget = $activity['gadget']; } $gadgetsActivities[$gadget][$activity['action']] = $activity['hits']; } } $saGadgets = $model->GetSiteActivityGadgets(); if (count($saGadgets) > 0) { foreach ($saGadgets as $gadget => $gTitle) { // load gadget $objGadget = Jaws_Gadget::getInstance($gadget); if (Jaws_Error::IsError($objGadget)) { continue; } // load hook $objHook = $objGadget->hook->load('SiteActivity'); if (Jaws_Error::IsError($objHook)) { continue; } // fetch gadget activity's action items $actions = $objHook->Execute(); $tpl->SetBlock('SiteActivity/gadget'); $tpl->SetVariable('gadget_title', $objGadget->title); foreach ($actions as $actionName => $actionTitle) { $tpl->SetBlock('SiteActivity/gadget/action'); $tpl->SetVariable('action', $actionTitle); $hits = isset($gadgetsActivities[$gadget][$actionName]) ? $gadgetsActivities[$gadget][$actionName] : 0; $tpl->SetVariable('hits', $hits); $tpl->ParseBlock('SiteActivity/gadget/action'); } $tpl->ParseBlock('SiteActivity/gadget'); } } else { $tpl->SetBlock('SiteActivity/no_activity'); $tpl->SetVariable('no_activity', _t('SITEACTIVITY_ACTIONS_NOT_FIND_ACTIVITY')); $tpl->ParseBlock('SiteActivity/no_activity'); } $tpl->ParseBlock('SiteActivity'); return $tpl->Get(); }
/** * Updates the page * * @access public * @param int $id The ID of the page to update * @param int $group The group of the page * @param bool $show_title Whether displays the title or not * @param string $title The title of the page * @param string $content The contents of the page * @param string $language The language of the page * @param string $fast_url The fast URL of the page * @param string $meta_keys Meta keywords * @param string $meta_desc Meta description * @param string $tags Tags * @param bool $published Whether the page is published or not * @param bool $auto Whether its an auto saved page or not * @return mixed True on success or Jaws_Error on failure */ function UpdatePage($id, $group, $show_title, $title, $content, $language, $fast_url, $meta_keys, $meta_desc, $tags, $published, $auto = false) { $fast_url = empty($fast_url) ? $title : $fast_url; $fast_url = $this->GetRealFastUrl($fast_url, 'static_pages', false); $page = $this->GetPage($id); if (Jaws_Error::isError($page)) { $GLOBALS['app']->Session->PushLastResponse(_t('STATICPAGE_ERROR_PAGE_NOT_FOUND'), RESPONSE_ERROR); return new Jaws_Error(_t('STATICPAGE_ERROR_PAGE_NOT_FOUND')); } $params['group_id'] = (int) $group; $params['base_language'] = $language; $params['fast_url'] = $fast_url; $params['show_title'] = (bool) $show_title; $params['updated'] = Jaws_DB::getInstance()->date(); $spTable = Jaws_ORM::getInstance()->table('static_pages'); $result = $spTable->update($params)->where('page_id', $id)->exec(); if (Jaws_Error::IsError($result)) { return new Jaws_Error(_t('STATICPAGE_ERROR_PAGE_NOT_UPDATED')); } $tModel = $this->gadget->model->loadAdmin('Translation'); $result = $tModel->UpdateTranslation($page['translation_id'], $title, $content, $language, $meta_keys, $meta_desc, $tags, $published); if (Jaws_Error::IsError($result)) { $GLOBALS['app']->Session->PushLastResponse(_t('STATICPAGE_ERROR_PAGE_NOT_UPDATED'), RESPONSE_ERROR); return new Jaws_Error(_t('STATICPAGE_ERROR_PAGE_NOT_UPDATED')); } $GLOBALS['app']->Session->PushLastResponse(_t('STATICPAGE_PAGE_UPDATED'), RESPONSE_NOTICE); return true; }
/** * Main Constructor * * @access public * @return void */ function SmartBridge_Plugin($plugin) { parent::Jaws_Plugin($plugin); $eg = $GLOBALS['app']->Registry->fetch('gadgets_enabled_items'); if (Jaws_Error::isError($eg)) { $eg = array(); } $this->_EnabledGadgets = explode(',', $eg); }
/** * Upgrades the gadget * * @access public * @param string $old Current version (in registry) * @param string $new New version (in the $gadgetInfo file) * @return bool True */ function Upgrade($old, $new) { // Update layout actions $layoutModel = Jaws_Gadget::getInstance('Layout')->model->loadAdmin('Layout'); if (!Jaws_Error::isError($layoutModel)) { $layoutModel->EditGadgetLayoutAction('Shoutbox', 'Display', 'Comments', 'Comments'); } return true; }
/** * Upgrades the gadget * * @access public * @param string $old Current version (in registry) * @param string $new New version (in the $gadgetInfo file) * @return mixed True on Success or Jaws_Error on Failure */ function Upgrade($old, $new) { // Update layout actions $layoutModel = Jaws_Gadget::getInstance('Layout')->model->loadAdmin('Layout'); if (!Jaws_Error::isError($layoutModel)) { $layoutModel->EditGadgetLayoutAction('Faq', 'ListCategories', 'ListCategories', 'Category'); } return true; }
/** * Does any actions required to finish the stage, such as DB queries. * * @access public * @return bool|Jaws_Error Either true on success, or a Jaws_Error * containing the reason for failure. */ function Run() { // Connect to database require_once JAWS_PATH . 'include/Jaws/DB.php'; $objDatabase = Jaws_DB::getInstance('default', $_SESSION['upgrade']['Database']); if (Jaws_Error::IsError($objDatabase)) { _log(JAWS_LOG_DEBUG, "There was a problem connecting to the database, please check the details and try again"); return new Jaws_Error(_t('UPGRADE_DB_RESPONSE_CONNECT_FAILED'), 0, JAWS_ERROR_WARNING); } // upgrade core database schema $old_schema = JAWS_PATH . 'upgrade/Resources/schema/0.9.0.xml'; $new_schema = JAWS_PATH . 'upgrade/Resources/schema/schema.xml'; if (!file_exists($old_schema)) { return new Jaws_Error(_t('GLOBAL_ERROR_SQLFILE_NOT_EXISTS', '0.9.0.xml'), 0, JAWS_ERROR_ERROR); } if (!file_exists($new_schema)) { return new Jaws_Error(_t('GLOBAL_ERROR_SQLFILE_NOT_EXISTS', 'schema.xml'), 0, JAWS_ERROR_ERROR); } _log(JAWS_LOG_DEBUG, "Upgrading core schema"); $result = Jaws_DB::getInstance()->installSchema($new_schema, '', $old_schema); if (Jaws_Error::isError($result)) { _log(JAWS_LOG_ERROR, $result->getMessage()); if ($result->getCode() !== MDB2_ERROR_ALREADY_EXISTS) { return new Jaws_Error($result->getMessage(), 0, JAWS_ERROR_ERROR); } } // Create application include_once JAWS_PATH . 'include/Jaws.php'; $GLOBALS['app'] = jaws(); $GLOBALS['app']->Registry->Init(); // Upgrading core gadgets $gadgets = array('UrlMapper', 'Settings', 'ControlPanel', 'Policy', 'Layout', 'Users', 'Comments'); foreach ($gadgets as $gadget) { $objGadget = Jaws_Gadget::getInstance($gadget); if (Jaws_Error::IsError($objGadget)) { _log(JAWS_LOG_DEBUG, "There was a problem loading core gadget: " . $gadget); return $objGadget; } $installer = $objGadget->installer->load(); if (Jaws_Error::IsError($installer)) { _log(JAWS_LOG_DEBUG, "There was a problem loading installer of core gadget: {$gadget}"); return $installer; } if (Jaws_Gadget::IsGadgetInstalled($gadget)) { $result = $installer->UpgradeGadget(); } else { continue; //$result = $installer->InstallGadget(); } if (Jaws_Error::IsError($result)) { _log(JAWS_LOG_DEBUG, "There was a problem installing/upgrading core gadget: {$gadget}"); return $result; } } return true; }
/** * Upgrades the gadget * * @access public * @param string $old Current version (in registry) * @param string $new New version (in the $gadgetInfo file) * @return mixed True on Success or Jaws_Error on Failure */ function Upgrade($old, $new) { // Update layout actions $layoutModel = Jaws_Gadget::getInstance('Layout')->model->loadAdmin('Layout'); if (!Jaws_Error::isError($layoutModel)) { $layoutModel->EditGadgetLayoutAction('Glossary', 'RandomTerms', 'RandomTerms', 'Term'); $layoutModel->EditGadgetLayoutAction('Glossary', 'ListOfTerms', 'ListOfTerms', 'Term'); } return true; }
/** * Update Settings * * @access public * @return array Response array (notice or error) */ function SaveSettings() { $this->gadget->CheckPermission('Settings'); $configuration = jaws()->request->fetch('gadgets_drivers:array', 'post'); $res = $this->gadget->registry->update('configuration', serialize($configuration)); if (Jaws_Error::isError($res)) { return $GLOBALS['app']->Session->GetResponse($res->getMessage(), RESPONSE_ERROR); } else { return $GLOBALS['app']->Session->GetResponse(_t('NOTIFICATION_SETTINGS_UPDATED'), RESPONSE_NOTICE); } }
/** * Generates a tag cloud * * @access public * @return mixed An array on success and Jaws_Error in case of errors */ function CreateTagCloud() { $table = Jaws_ORM::getInstance()->table('blog_entrycat'); $table->select('count(category_id) as howmany:integer', 'name', 'fast_url', 'category_id:integer'); $table->join('blog_category', 'category_id', 'id'); $res = $table->groupBy('category_id', 'name', 'fast_url')->orderBy('name')->fetchAll(); if (Jaws_Error::isError($res)) { return new Jaws_Error(_t('BLOG_ERROR_TAGCLOUD_CREATION_FAILED')); } return $res; }
/** * Upgrades the gadget * * @access public * @param string $old Current version (in registry) * @param string $new New version (in the $gadgetInfo file) * @return mixed True on success, Jaws_Error otherwise */ function Upgrade($old, $new) { if (version_compare($old, '1.0.0', '<')) { // Update layout actions $layoutModel = Jaws_Gadget::getInstance('Layout')->model->loadAdmin('Layout'); if (!Jaws_Error::isError($layoutModel)) { $layoutModel->EditGadgetLayoutAction('Launcher', 'Execute', 'Script', 'Script'); } } return true; }
/** * Upgrades the gadget * * @access public * @param string $old Current version (in registry) * @param string $new New version (in the $gadgetInfo file) * @return mixed True on Success or Jaws_Error on Failure */ function Upgrade($old, $new) { // Update layout actions $layoutModel = Jaws_Gadget::getInstance('Layout')->model->loadAdmin('Layout'); if (!Jaws_Error::isError($layoutModel)) { $layoutModel->EditGadgetLayoutAction('Poll', 'Display', 'Poll', 'Poll'); $layoutModel->EditGadgetLayoutAction('Poll', 'LastPoll', 'Poll', 'Poll'); $layoutModel->EditGadgetLayoutAction('Poll', 'ListOfPolls', 'Polls', 'Polls'); } return true; }
/** * Upgrades the gadget * * @access public * @param string $old Current version (in registry) * @param string $new New version (in the $gadgetInfo file) * @return mixed True on Success or Jaws_Error on Failure */ function Upgrade($old, $new) { // Update layout actions $layoutModel = Jaws_Gadget::getInstance('Layout')->model->loadAdmin('Layout'); if (!Jaws_Error::isError($layoutModel)) { $layoutModel->EditGadgetLayoutAction('Contact', 'Display', 'Contact', 'Contact'); $layoutModel->EditGadgetLayoutAction('Contact', 'DisplayMini', 'ContactMini', 'Contact'); $layoutModel->EditGadgetLayoutAction('Contact', 'DisplaySimple', 'ContactSimple', 'Contact'); $layoutModel->EditGadgetLayoutAction('Contact', 'DisplayFull', 'ContactFull', 'Contact'); } return true; }
/** * Returns an array with all available items the Menu gadget * can use * * @access public * @return array URLs array */ function Execute() { $urls = array(); $model = $this->gadget->model->load('Scripts'); $scripts = $model->GetScripts(); if (!Jaws_Error::isError($scripts)) { foreach ($scripts as $script) { $urls[] = array('url' => $this->gadget->urlMap('Execute', array('script' => $script)), 'title' => $script); } } return $urls; }
/** * Upgrades the gadget * * @access public * @param string $old Current version (in registry) * @param string $new New version (in the $gadgetInfo file) * @return mixed True on success, Jaws_Error otherwise */ function Upgrade($old, $new) { // Update layout actions $layoutModel = Jaws_Gadget::getInstance('Layout')->model->loadAdmin('Layout'); if (!Jaws_Error::isError($layoutModel)) { $layoutModel->EditGadgetLayoutAction('SysInfo', 'SysInfo', 'SysInfo', 'SysInfo'); $layoutModel->EditGadgetLayoutAction('SysInfo', 'PHPInfo', 'PHPInfo', 'PHPInfo'); $layoutModel->EditGadgetLayoutAction('SysInfo', 'JawsInfo', 'JawsInfo', 'JawsInfo'); $layoutModel->EditGadgetLayoutAction('SysInfo', 'DirInfo', 'DirInfo', 'DirInfo'); } return true; }
/** * The preg_replace call back function * * @access private * @param string $data Matched strings from preg_replace_callback * @return string Block content or blank text */ function Prepare($data) { $blockID = isset($data[1]) ? $data[1] : ''; if (Jaws_Gadget::IsGadgetInstalled('Blocks') && !empty($blockID)) { $objBlocks = Jaws_Gadget::getInstance('Blocks')->action->load('Block'); $result = $objBlocks->Block($blockID); if (!Jaws_Error::isError($result)) { return $result; } } return ''; }
/** * Returns all available languages a page has been translated to * * @access public * @param int $page Page ID * @param bool $onlyPublished Publish status of the page * @return mixed Array of language codes / False if no code are found */ function GetTranslationsOfPage($page, $onlyPublished = false) { $sptTable = Jaws_ORM::getInstance()->table('static_pages_translation'); $sptTable->select('translation_id:integer', 'language')->where('base_id', $page); if ($onlyPublished) { $sptTable->and()->where('published', true); } $result = $sptTable->fetchAll(); if (Jaws_Error::isError($result)) { return false; } return count($result) > 0 ? $result : false; }
/** * Upgrades the gadget * * @access public * @param string $old Current version (in registry) * @param string $new New version (in the $gadgetInfo file) * @return mixed True on success, Jaws_Error otherwise */ function Upgrade($old, $new) { if (version_compare($old, '0.9.0', '<')) { // Update layout actions $layoutModel = Jaws_Gadget::getInstance('Layout')->model->loadAdmin('Layout'); if (!Jaws_Error::isError($layoutModel)) { $layoutModel->EditGadgetLayoutAction('Search', 'Box', 'Box', 'Search'); $layoutModel->EditGadgetLayoutAction('Search', 'SimpleBox', 'SimpleBox', 'Search'); $layoutModel->EditGadgetLayoutAction('Search', 'AdvancedBox', 'AdvancedBox', 'Search'); } } return true; }
/** * Get the layout items * * @access public * @param int $user User's ID * @param bool $index Elements in index layout * @param bool $published Publish status * @return array Returns an array with the layout items or Jaws_Error on failure */ function GetLayoutItems($user = 0, $index = false, $published = null) { $lyTable = Jaws_ORM::getInstance()->table('layout'); $lyTable->select('id', 'gadget', 'gadget_action', 'action_params', 'action_filename', 'display_when', 'section', 'layout_position'); $lyTable->where('user', (int) $user)->and()->where('index', (bool) $index); if (!is_null($published)) { $lyTable->and()->where('published', (bool) $published); } $items = $lyTable->orderBy('layout_position asc')->fetchAll(); if (!Jaws_Error::isError($items) && $index) { array_unshift($items, array('id' => null, 'gadget' => '[REQUESTEDGADGET]', 'gadget_action' => '[REQUESTEDACTION]', 'action_params' => '', 'action_filename' => '', 'display_when' => '*', 'section' => 'main', 'layout_position' => 0)); } return $items; }
/** * Get then Banners action params * * @access public * @return array list of the Banners action params */ function BannersLayoutParams() { $result = array(); $bModel = $this->gadget->model->load('Groups'); $groups = $bModel->GetGroups(); if (!Jaws_Error::isError($groups)) { $pgroups = array(); foreach ($groups as $group) { $pgroups[$group['id']] = $group['title']; } $result[] = array('title' => _t('BANNER_GROUPS_GROUP'), 'value' => $pgroups); } return $result; }
/** * Returns an array with all available items the Menu gadget can use * * @access public * @return array List of URLs */ function Execute() { $urls[] = array('url' => $this->gadget->urlMap('DisplayFeeds'), 'title' => $this->gadget->title); $model = $this->gadget->model->load('Feed'); $feeds = $model->GetFeeds(); if (!Jaws_Error::isError($feeds)) { $max_size = 20; foreach ($feeds as $feed) { $url = $this->gadget->urlMap('GetFeed', array('id' => $feed['id'])); $urls[] = array('url' => $url, 'title' => Jaws_UTF8::strlen($feed['title']) > $max_size ? Jaws_UTF8::substr($feed['title'], 0, $max_size) . '...' : $feed['title']); } } return $urls; }
/** * Get Category action params * * @access public * @return array list of Category action params */ function CategoryLayoutParams() { $result = array(); $model = $this->gadget->model->load('Groups'); $groups = $model->GetGroups(); if (!Jaws_Error::isError($groups)) { $pgroups = array(); foreach ($groups as $group) { $pgroups[$group['id']] = $group['title']; } $result[] = array('title' => _t('GLOBAL_CATEGORY'), 'value' => $pgroups); } return $result; }
/** * Get Display action params * * @access public * @return array list of Display action params */ function DisplayLayoutParams() { $result = array(); $qModel = $this->gadget->model->load('Groups'); $groups = $qModel->GetGroups(); if (!Jaws_Error::isError($groups)) { $pgroups = array(); foreach ($groups as $group) { $pgroups[$group['id']] = $group['title']; } $result[] = array('title' => _t('QUOTES_QUOTE'), 'value' => $pgroups); } return $result; }
/** * Get Display action params * * @access public * @return array list of Display action params */ function BlockLayoutParams() { $result = array(); $bModel = $this->gadget->model->load('Block'); $blocks = $bModel->GetBlocks(true); if (!Jaws_Error::isError($blocks)) { $pblocks = array(); foreach ($blocks as $block) { $pblocks[$block['id']] = $block['title']; } $result[] = array('title' => _t('BLOCKS_BLOCK'), 'value' => $pblocks); } return $result; }
/** * Get Display action params * * @access public * @return array list of Display action params */ function MenuLayoutParams() { $result = array(); $model = $this->gadget->model->load('Group'); $groups = $model->GetGroups(); if (!Jaws_Error::isError($groups)) { $pgroups = array(); foreach ($groups as $group) { $pgroups[$group['id']] = $group['title']; } $result[] = array('title' => _t('MENU_ACTIONS_MENU'), 'value' => $pgroups); } return $result; }
/** * Get Display action params * * @access public * @return array list of Display action params */ function DisplayFeedsLayoutParams() { $result = array(); $rModel = $this->gadget->model->load('Feed'); $sites = $rModel->GetFeeds(); if (!Jaws_Error::isError($sites)) { $psites = array(); foreach ($sites as $site) { $psites[$site['id']] = $site['title']; } $result[] = array('title' => _t('FEEDREADER_FEED'), 'value' => $psites); } return $result; }