public function Copy($pSelector) { $rowData = $this->Find($pSelector, 0)->outertext; $element = new cHTML(); $element->Load($rowData); return $element; }
private function _Prep() { $Circles = $this->Talk('Friends', 'Circles'); $Current = urldecode(str_replace('-', ' ', $this->GetSys('Request')->Get('Circle'))); if (!$Current) { $this->View->Find('.friends', 0)->class .= ' selected '; } $this->View->Find('.friends .link', 0)->href = '/profile/' . $this->_Current->Username . '/news/'; $this->View->Find('.add', 0)->href = '/profile/' . $this->_Current->Username . '/friends/circles/add'; if (!$Circles) { return false; } $li = $this->View->Find('.list', 0); $row = $this->View->Copy('.list')->Find('.circle', 0); $rowOriginal = $row->outertext; $this->View->Find('.circle', 0)->outertext = ''; foreach ($Circles as $c => $circle) { $row = new cHTML(); $row->Load($rowOriginal); $row->Find('.link', 0)->innertext = $circle; $row->Find('.link', 0)->href = '/profile/' . $this->_Current->Username . '/news/' . urlencode(str_replace(' ', '-', $circle)); if ($Current == strtolower($circle)) { $row->Find('.item', 0)->class .= ' selected '; } $li->innertext .= $row->outertext; unset($row); } $this->View->Reload(); return true; }
private function _PrepSummary() { $tabs = $this->View->Find('nav[id=profile-friends-tabs]', 0); $tabs->innertext = $this->GetSys('Components')->Buffer('friends', 'tabs'); $data = array("account" => $this->_Current->Account, 'source' => ASD_DOMAIN, 'request' => $this->_Current->Account); $currentInfo = $this->GetSys("Event")->Trigger("On", "User", "Info", $data); $currentInfo->username = $current->Username; $currentInfo->domain = $current->Domain; $currentInfo->account = $current->Username . '@' . $current->Domain; $data = array("account" => $this->_Focus->Account, 'source' => ASD_DOMAIN, 'request' => $this->_Focus->Account); $focusInfo = $this->GetSys("Event")->Trigger("On", "User", "Info", $data); $focusInfo->username = $this->_Focus->Username; $focusInfo->domain = $this->_Focus->Domain; $focusInfo->account = $this->_Focus->Username . '@' . $this->_Focus->Domain; // Calculate the mutual friends, randomize them, and limit to 10. $mutualFriends = array_intersect($currentInfo->friends, $focusInfo->friends); shuffle($mutualFriends); $mutualFriends = array_slice($mutualFriends, 0, 10); if (count($mutualFriends) < 1) { return false; } $li = $this->View->Find("[class=friends-mutual-summary-item]", 0); $row = $this->View->Copy("[class=friends-mutual-summary-item]")->Find("[class=friends-mutual-summary-item]", 0); $rowOriginal = $row->outertext; $li->innertext = ''; foreach ($mutualFriends as $m => $mutualFriend) { $row = new cHTML(); $row->Load($rowOriginal); list($username, $domain) = split('@', $mutualFriend); $data = array("username" => $username, "domain" => $domain, "width" => 32, "height" => 32); $row->Find('[class=friends-icon]', 0)->src = $this->GetSys("Event")->Trigger("On", "User", "Icon", $data); $row->Find('[class=friends-icon-link]', 0)->href = 'http://' . $domain . '/profile/' . $username . '/'; $li->innertext .= $row->outertext; unset($row); } return true; }
private function _Prep() { $requestedIdentifier = $this->GetSys('Request')->Get('Identifier'); $this->References->RetrieveReferences($this->_Focus->Id, $requestedIdentifier); $li = $this->View->Find('.list .item', 0); $row = $this->View->Copy('.list')->Find('.item', 0); $rowOriginal = $row->outertext; $li->outertext = ''; if ($this->References->Get('Total') == 0) { $li->outertext = ''; } $this->_Editor = false; if ($this->_CheckEditor()) { $this->_Editor = true; } while ($this->References->Fetch()) { $Type = $this->References->Get('Type'); $Identifier = $this->References->Get('Identifier'); if (!($this->_Item = $this->_ReferenceByType($Type, $Identifier))) { continue; } $this->_Item['Comment'] = $this->GetSys('Render')->Format($this->_Item['Comment']); $this->_Item['Comment'] = $this->GetSys('Render')->LiveLinks($this->_Item['Comment']); $this->_Item['Identifier'] = $Identifier; $row = new cHTML(); $row->Load($rowOriginal); switch (strtolower($Type)) { case 'link': $row->Find('.item', 0)->class .= ' link'; $row->Find('.item', 0)->innertext = $this->_PrepLink(); break; case 'post': default: $row->Find('.item', 0)->class .= ' post'; $row->Find('.item', 0)->innertext = $this->_PrepPost(); break; } $li->outertext .= $row->outertext; unset($row); } $this->View->Reload(); if ($requestedIdentifier) { $this->_PrepComments($Type, $this->_Item['PK']); } return true; }
private function _Prep() { if ($this->_Focus->Account == $this->_Current->Account) { $this->View->Find('form[class="add"]', 0)->action = '/profile/' . $this->_Focus->Username . '/photos/'; $this->View->Find('[name="Context"]', 0)->value = $this->Get('Context'); } else { $this->View->Find('form[class="add"]', 0)->outertext = ''; } $list = $this->View->Find('.list', 0); $itemOriginal = $this->View->Find('.item', 0)->outertext; $list->innertext = ""; if ($this->Sets->Get('Total') == 0) { return false; } while ($this->Sets->Fetch()) { $item = new cHTML(); $item->Load($itemOriginal); $id = $this->Sets->Get('Set_PK'); $this->Photo->GetCover($id); $item->Find('.name', 0)->innertext = $this->Sets->Get('Name'); $item->Find('.description', 0)->innertext = $this->Sets->Get('Description'); $filename = $this->Photo->Get('Filename'); $extension = pathinfo($filename, PATHINFO_EXTENSION); $link = 'http://' . ASD_DOMAIN . '/profile/' . $this->_Focus->Username . '/photos/' . $this->Sets->Get('Directory'); $item->Find('.photoset-name-link', 0)->href = $link; $item->Find('.photoset-cover-link', 0)->href = $link; list($file) = explode('.' . $extension, $filename); $Identifier = $this->Photo->Get('Identifier'); $coverLocation = 'http://' . ASD_DOMAIN . '/_storage/photos/' . $this->_Focus->Username . '/' . $this->Sets->Get('Directory') . '/' . $Identifier . '.m' . '.jpg'; $coverFile = ASD_PATH . '_storage/photos/' . $this->_Focus->Username . '/' . $this->Sets->Get('Directory') . '/' . $Identifier . '.m' . '.jpg'; if (file_exists($coverFile)) { $item->Find('.cover', 0)->src = $coverLocation; } else { $item->Find('.cover', 0)->class .= ' none '; } $list->innertext .= $item->outertext; } return true; }
private function _Prep() { $focus = $this->Talk('User', 'Focus'); $current = $this->Talk('User', 'Current'); $ul = $this->View->Find("[class=friends-tabs-list]", 0); $rowOriginal = $this->View->Copy("[class=friends-tabs-list]")->Find("li", 0)->outertext; $row = new cHTML(); $row->Load($rowOriginal); $ul->innertext = ""; $currentCircle = urldecode(strtolower($this->GetSys("Request")->Get("Circle"))); // All $row->Find("a", 0)->innertext = "All"; $row->Find(" a", 0)->href = '/profile/' . $focus->Username . '/friends/'; $row->Find("li", 0)->class .= " system system-all"; if (!$currentCircle) { $row->Find("li", 0)->class .= " selected "; } $ul->innertext .= $row->outertext; if ($current->Account == $focus->Account) { // Requests $row->Load($rowOriginal); $row->Find("a", 0)->innertext = "Requests"; $row->Find("a", 0)->href = '/profile/' . $focus->Username . '/friends/requests/'; $row->Find("li", 0)->class .= " system system-all"; if ($currentCircle == 'requests') { $row->Find("li", 0)->class .= " selected "; } $ul->innertext .= $row->outertext; // Create a model for Circles. $this->Circles = $this->GetModel("Circles"); $circles = $this->Circles->Circles($focus->Account_PK); // No circles were found, so we're done. if (count($circles) == 0) { return true; } // Create the Circles tabs foreach ($circles as $c => $circle) { $row->Load($rowOriginal); $row->Find("a", 0)->innertext = $circle['name']; $row->Find("a", 0)->href = '/profile/' . $focus->Username . '/friends/' . str_replace(' ', '-', strtolower($circle['name'])); // Select the current tab if ($currentCircle == str_replace(' ', '-', strtolower($circle['name']))) { $row->Find("li", 0)->class .= " selected "; } $ul->innertext .= $row->outertext; } } else { if ($current) { // Mutual $row->Load($rowOriginal); $row->Find("a", 0)->innertext = "Mutual"; $row->Find("li", 0)->class .= " system system-requests "; $row->Find("a", 0)->href = 'http://' . ASD_DOMAIN . '/profile/' . $focus->Username . '/friends/mutual/'; if ($currentCircle == 'mutual') { $row->Find("li", 0)->class .= " selected "; } $ul->innertext .= $row->outertext; } else { } } return true; }
public function _Prep($pType = null, $pIdentifier = null) { $li = $this->_View->Find('.circle', 0); $row = $this->_View->Copy('.circle', 0)->Find('.circle', 0); $rowOriginal = $row->outertext; $li->innertext = ''; $circles = $this->Talk('Friends', 'Circles'); $inputPrivacy = $this->GetSys('Request')->Get('Privacy'); if ($inputPrivacy) { // Use REQUEST instead of the current or default. $currentPrivacy = new stdClass(); $currentPrivacy->Circles = array(); $nobody = $inputPrivacy['nobody']; $friends = $inputPrivacy['friends']; $everybody = $inputPrivacy['everybody']; if ($friends == 'on') { $this->_View->Find('[name=Privacy[friends]]', 0)->checked = true; $this->_View->Find('[name=Privacy[nobody]]', 0)->checked = false; } else { if ($everybody == 'on') { $this->_View->Find('[name=Privacy[everybody]]', 0)->checked = true; $this->_View->Find('[name=Privacy[nobody]]', 0)->checked = false; } else { if ($nobody == 'on') { } else { $this->_View->Find('[name=Privacy[nobody]]', 0)->checked = false; $circleKeys = array_flip($circles); foreach ($inputPrivacy as $i => $input) { $selected[] = strtolower($i); } foreach ($circleKeys as $circle => $id) { if (in_array(strtolower($circle), $selected)) { $currentPrivacy->Circles[] = $id; } } } } } } else { if ($pType && $pIdentifier) { $currentPrivacy = $this->_Model->RetrieveItem($this->_Focus->Id, $pType, $pIdentifier); if ($currentPrivacy->Friends == 1) { $this->_View->Find('[name=Privacy[friends]]', 0)->checked = true; $this->_View->Find('[name=Privacy[nobody]]', 0)->checked = false; } else { if ($currentPrivacy->Everybody == 1) { $this->_View->Find('[name=Privacy[everybody]]', 0)->checked = true; $this->_View->Find('[name=Privacy[nobody]]', 0)->checked = false; } else { if (count($currentPrivacy->Circles) > 0) { $this->_View->Find('[name=Privacy[nobody]]', 0)->checked = false; } } } } } foreach ($circles as $c => $circle) { $row = new cHTML(); $row->Load($rowOriginal); $row->Find('label', 0)->innertext = $circle; $row->Find('input', 0)->name = 'Privacy[' . $circle . ']'; // Determine if this circle is selected. if (isset($currentPrivacy) and in_array($c, $currentPrivacy->Circles)) { $row->Find('input', 0)->checked = true; } $li->innertext .= $row->outertext; unset($row); } return true; }
private function _BuildChildren($pParent, $pChildren, $pOriginal) { $return = ''; foreach ($pChildren as $c => $child) { if ($child['Parent_ID'] != $pParent) { continue; } $row = new cHTML(); $row->Load($pOriginal); $row->Find('ol', 0)->class = 'comments nested'; $this->_PrepComment($row, $child); if ($Children = $this->_GetChildren($child['Entry_PK'])) { $row->Find('.nesting', 0)->innertext .= $this->_BuildChildren($child['Entry_PK'], $Children, $pOriginal); } $return .= $row->outertext; unset($row); } return $return; }
private function _ProcessStyles() { $stylesheets = $this->View->Find('[rel="stylesheet"]', 0)->outertext; $styles = $this->GetSys('Theme')->GetStyles(); $order = $this->GetSys('Theme')->Get('Config')->GetConfiguration('order'); $skip = $this->GetSys('Theme')->Get('Config')->GetConfiguration('skip'); // Reorder the styles according to the configuration if (isset($order)) { if (isset($skip)) { $skip = explode(' ', $this->GetSys('Theme')->Get('Config')->GetConfiguration('skip')); } foreach ($order as $o => $ostyle) { foreach ($styles as $s => $style) { if (strstr($style, $ostyle)) { if (in_array($ostyle, $skip)) { continue; } $orderedstyles[] = $style; unset($styles[$s]); } } } } // Add the remaining styles to the end of the list. foreach ($styles as $s => $style) { $orderedstyles[] = $style; } $styles = $orderedstyles; foreach ($styles as $s => $style) { $location = ASD_PATH . 'themes/' . $style; $path = 'http://' . ASD_DOMAIN . '/themes/' . $style; $style = new cHTML(); $style->Load($stylesheets); $style->Find('[rel="stylesheet"]', 0)->href = $path; if (strstr($path, '.less')) { $style->Find('[rel="stylesheet"]', 0)->rel = "stylesheet/less"; } else { $style->Find('[rel="stylesheet"]', 0)->rel = "stylesheet"; } $this->View->Find('[rel="stylesheet"]', 0)->outertext .= "\n" . $style->outertext; } $this->View->Reload(); $this->View->Find('[rel="stylesheet"]', 0)->outertext = ""; return true; }
private function _Prep() { list($this->_PageStart, $this->_PageStep, $this->_Page) = $this->_PageCalc(); if ($this->_Current->Account == $this->_Focus->Account) { $this->View->Find('.add', 0)->href = '/profile/' . $this->_Focus->Username . '/journal/add/'; } else { $this->View->Find('.add', 0)->outertext = ""; } $this->View->Find('.rss', 0)->href = '/profile/' . $this->_Focus->Username . '/journal/rss/'; // If we don't find any entries, remove the template row, and return false if (!$this->Model->Entries($this->_Focus->Id, array('start' => $this->_PageStart, 'step' => $this->_PageStep))) { $this->View->Find('.journal-entries', 0)->outertext = ""; return false; } $link = '/profile/' . $this->_Focus->Username . '/journal/(.*)'; $pageData = array('start' => $this->_PageStart, 'step' => $this->_PageStep, 'total' => $this->Model->Get("Total"), 'link' => $link); $pageControls = $this->View->Find("nav[class=pagination]"); foreach ($pageControls as $p => $pageControl) { $pageControl->innertext = $this->GetSys("Components")->Buffer("pagination", $pageData); } $li = $this->View->Find('ul[class=journal-entries] li', 0); $row = $this->View->Copy('[class=journal-entries]')->Find('li', 0); $rowOriginal = $row->outertext; $li->innertext = ''; while ($this->Model->Fetch()) { $row = new cHTML(); $row->Load($rowOriginal); $url = strtolower(str_replace(' ', '-', $this->Model->Get('Title'))); $summary = $this->_Summary($this->Model->Get('Body')); $row->Find('.title-link', 0)->innertext = $this->Model->Get("Title"); $row->Find('.title-link', 0)->href = '/profile/' . $this->_Focus->Username . '/journal/' . $url; $row->Find('.body', 0)->innertext = $summary; $username = $this->Model->Get('Submitted_Username'); $domain = $this->Model->Get('Submitted_Domain'); $data = array('username' => $username, 'domain' => $domain, 'width' => 64, 'height' => 64); $row->Find('.icon', 0)->src = $this->GetSys('Event')->Trigger('On', 'User', 'Icon', $data); $data = array('account' => $username . '@' . $domain, 'source' => ASD_DOMAIN); $row->Find('.submitted', 0)->href = $this->GetSys('Event')->Trigger('Create', 'User', 'Link', $data); $data = array('account' => $username . '@' . $domain, 'source' => ASD_DOMAIN); $row->Find('.fullname', 0)->href = $this->GetSys('Event')->Trigger('Create', 'User', 'Link', $data); $row->Find('.fullname', 0)->innertext = $username . '@' . $domain; $row->Find('.readmore', 0)->href = '/profile/' . $this->_Focus->Username . '/journal/' . $url; $row->Find('.created', 0)->innertext = $this->GetSys('Date')->Format($this->Model->Get('Created'), true); $li->innertext .= $row->outertext; unset($row); } $this->_PrepMessage(); return true; }
private function _Prep() { if (!$this->_Current) { $this->_PrepAnonymous(); } else { if ($this->_Current->Account == $this->_Focus->Account) { $this->_PrepEditor(); } else { $this->_PrepCurrent(); } } $tabs = $this->View->Find('nav[id=profile-friends-tabs]', 0); $tabs->innertext = $this->GetSys('Components')->Buffer('friends', 'tabs'); if ($this->_Current) { $data = array('account' => $this->_Current->Account, 'source' => ASD_DOMAIN, 'request' => $this->_Current->Account); $currentInfo = $this->GetSys('Event')->Trigger('On', 'User', 'Info', $data); $currentInfo->username = $this->_Current->Username; $currentInfo->domain = $this->_Current->Domain; $currentInfo->account = $this->_Current->Username . '@' . $this->_Current->Domain; } $friendCount = $this->Model->Get('Total'); $li = $this->View->Find('ul[class=friends-list] li', 0); $row = $this->View->Copy('[class=friends-list]')->Find('li', 0); $rowOriginal = $row->outertext; $li->innertext = ''; while ($this->Model->Fetch()) { $row = new cHTML(); $row->Load($rowOriginal); $username = $this->Model->Get('Username'); $domain = $this->Model->Get('Domain'); $request = $username . '@' . $domain; $data = array('username' => $username, 'domain' => $domain, 'width' => 64, 'height' => 64); $row->Find('[class=friends-icon]', 0)->src = $this->GetSys('Event')->Trigger('On', 'User', 'Icon', $data); $row->Find('[class=friends-icon]', 0)->class .= " usericon"; $data = array('account' => $this->_Current->Account, 'request' => $request); $row->Find('[class=friends-add-friend-link]', 0)->href = $this->GetSys('Event')->Trigger('Create', 'Friend', 'Addlink', $data); $row->Find('[class=friends-remove-friend-link]', 0)->href = $this->GetSys('Event')->Trigger('Create', 'Friend', 'Removelink', $data); $data = array('account' => $this->_Current->Account, 'source' => ASD_DOMAIN, 'request' => $request); $userInfo = $this->GetSys('Event')->Trigger('On', 'User', 'Info', $data); $userInfo->username = $username; $userInfo->domain = $domain; $userInfo->account = $username . '@' . $domain; $row->Find('[class=friends-location]', 0)->innertext = $userInfo->location; $row->Find('[class=friends-status]', 0)->innertext = $userInfo->status; $data = array('account' => $userInfo->account); $row->Find('[class=friends-identity]', 0)->href = $this->GetSys('Event')->Trigger('Create', 'User', 'Link', $data); $row->Find('[class=friends-identity]', 0)->innertext = $username . '@' . $domain; $row->Find('[class=friends-fullname-link]', 0)->innertext = $userInfo->fullname; $row->Find('[class=friends-fullname-link]', 0)->href = $this->GetSys('Event')->Trigger('Create', 'User', 'Link', $data); $row->Find('[class=friends-icon-link]', 0)->href = $this->GetSys('Event')->Trigger('Create', 'User', 'Link', $data); $mutualFriendsCount = count(array_intersect($currentInfo->friends, $userInfo->friends)); if ($mutualFriendsCount == 1) { $row->Find('[class=friends-mutual-count]', 0)->innertext = __('Mutual Friend Count', array('count' => $mutualFriendsCount)); } else { if ($mutualFriendsCount > 1) { $row->Find('[class=friends-mutual-count]', 0)->innertext = __('Mutual Friends Count', array('count' => $mutualFriendsCount)); } else { $row->Find('[class=friends-mutual-count]', 0)->innertext = ''; } } if (!$this->_Current) { $row = $this->_PrepAnonymousRow($row); } else { if ($this->_Current->Account == $this->_Focus->Account) { $row = $this->_PrepEditorRow($row); } else { $row = $this->_PrepCurrentRow($row, $currentInfo, $userInfo); } } $li->innertext .= $row->outertext; unset($row); } $pageData = array('start' => $this->_PageStart, 'step' => $this->_PageStep, 'total' => $friendCount, 'link' => $this->_PageLink); $pageControl = $this->View->Find('nav[class=pagination]', 0); $pageControl->innertext = $this->GetSys('Components')->Buffer('pagination', $pageData); $this->_PrepMessage(); $this->View->Reload(); return true; }
private function _Prep() { $Circle = urldecode(str_replace('-', ' ', $this->GetSys('Request')->Get('Circle'))); $friendsInCircle = $this->Talk('Friends', 'FriendsInCircle', array('Circle' => $Circle)); if ($Circle and !$friendsInCircle) { $this->View->Find('.list .item', 0)->outertext = ''; return false; } $this->Model->Incoming($this->_Focus->Id, $friendsInCircle); $li = $this->View->Find('.list .item', 0); $row = $this->View->Copy('.list')->Find('.item', 0); $rowOriginal = $row->outertext; $li->outertext = ''; while ($this->Model->Fetch()) { $row = new cHTML(); $row->Load($rowOriginal); $Action = $this->Model->Get('Action'); $Context = $this->Model->Get('Context'); switch ($Context) { case 'page': $row->Find('.item', 0)->class .= ' page'; break; case 'friends': $row->Find('.item', 0)->class .= ' friends'; break; } switch (strtolower($Action)) { case 'posted a journal': $row->Find('.item', 0)->class .= ' link'; $row->Find('.item', 0)->innertext = $this->_PrepJournal(); break; case 'added a photo': $row->Find('.item', 0)->class .= ' link'; $row->Find('.item', 0)->innertext = $this->_PrepPhoto(); break; case 'posted a link': $row->Find('.item', 0)->class .= ' link'; $row->Find('.item', 0)->innertext = $this->_PrepLink(); break; default: case 'posted': $row->Find('.item', 0)->class .= ' post'; $row->Find('.item', 0)->innertext = $this->_PrepPost(); break; } $li->outertext .= $row->outertext; unset($row); } $this->View->Reload(); }