protected function placeholder($id) { $placeholder = new HTMLTag('span', false, false); $placeholder->createAttribute('id', 'hashover-placeholder-' . $id); $placeholder->appendAttribute('id', '-' . $this->fromVariable('permalink'), false); if (!empty($this->comment[$id])) { $placeholder->innerHTML($this->comment[$id]); } return $placeholder->asHTML(); }
protected function editCheck($permalink, $comment, $subscribed = true) { if (!empty($_GET['hashover_edit'])) { if ($_GET['hashover_edit'] === $permalink) { $file = substr($permalink, 1); $file = str_replace('r', '-', $file); $file = str_replace('_pop', '', $file); $body = $comment['body']; $body = preg_replace($this->linkRegex, '\\1', $body); $name = !empty($comment['name']) ? $comment['name'] : ''; $website = !empty($comment['website']) ? $comment['website'] : ''; $form = new HTMLTag('form', false, false); $form->createAttribute('id', 'hashover-edit-' . $permalink); $form->createAttribute('class', 'hashover-edit-form'); $form->createAttribute('method', 'post'); $form->createAttribute('action', $_SERVER['PHP_SELF']); $form->innerHTML($this->html->editForm($permalink, $file, $name, $website, $body, $subscribed)); return $form->asHTML(); } } }
public function replyForm($permalink = '', $file = '', $subscribed = true) { // Create HashOver reply form $reply_form = new HTMLTag('div'); $reply_form->createAttribute('class', 'hashover-balloon'); // If avatars are enabled if ($this->setup->iconMode !== 'none') { // Create avatar element for HashOver reply form $reply_avatar = new HTMLTag('div'); $reply_avatar->createAttribute('class', 'hashover-avatar-image'); // Add count element to avatar element $reply_avatar->appendChild($this->avatar('+')); // Add avatar element to inputs wrapper element $reply_form->appendChild($reply_avatar); } // Display default login inputs when logged out if ($this->setup->userIsLoggedIn === false) { $reply_form->appendChild($this->defaultLoginInputs); } // Create label element for comment textarea if ($this->setup->usesLabels) { $reply_comment_label = new HTMLTag('label', false, false); $reply_comment_label->createAttribute('for', 'hashover-reply-comment'); $reply_comment_label->createAttribute('class', 'hashover-comment-label'); $reply_comment_label->innerHTML($this->locales->locale('reply_form', $this->addcslashes)); // Add comment label to form element $reply_form->appendChild($reply_comment_label); } // Create reply textarea $reply_textarea = new HTMLTag('textarea'); $reply_textarea->createAttribute('id', 'hashover-reply-comment'); $reply_textarea->createAttribute('class', 'hashover-textarea'); $reply_textarea->appendAttribute('class', 'hashover-reply-textarea'); $reply_textarea->createAttribute('cols', '62'); $reply_textarea->createAttribute('name', 'comment'); $reply_textarea->createAttribute('rows', '5'); $reply_textarea->createAttribute('title', $this->locales->locale('form_tip', $this->addcslashes)); $reply_textarea->createAttribute('placeholder', $this->locales->locale('reply_form', $this->addcslashes)); // Add reply textarea element to form element $reply_form->appendChild($reply_textarea); // Create hidden page title input element $reply_page_title_input = new HTMLTag('input', true); $reply_page_title_input->createAttribute('type', 'hidden'); $reply_page_title_input->createAttribute('name', 'title'); $reply_page_title_input->createAttribute('value', $this->pageTitle); // Add hidden page title input element to form element $reply_form->appendChild($reply_page_title_input); // Create hidden page URL input element $reply_page_url_input = new HTMLTag('input', true); $reply_page_url_input->createAttribute('type', 'hidden'); $reply_page_url_input->createAttribute('name', 'url'); $reply_page_url_input->createAttribute('value', $this->pageURL); // Add hidden page title input element to form element $reply_form->appendChild($reply_page_url_input); // Create hidden reply to input element if (!empty($file)) { $reply_to_input = new HTMLTag('input', true); $reply_to_input->createAttribute('type', 'hidden'); $reply_to_input->createAttribute('name', 'reply_to'); if ($this->setup->mode !== 'php') { $reply_to_input->createAttribute('value', $this->injectVar($file)); } else { $reply_to_input->createAttribute('value', $file); } // Add hidden reply to input element to form element $reply_form->appendChild($reply_to_input); } // Create element for various messages when needed $reply_message = new HTMLTag('div'); $reply_message->createAttribute('id', 'hashover-message-' . $this->injectVar($permalink)); $reply_message->createAttribute('class', 'hashover-message'); // Add message element to reply form element $reply_form->appendChild($reply_message); // Create reply form footer element $reply_form_footer = new HTMLTag('div'); $reply_form_footer->createAttribute('class', 'hashover-form-footer'); // Add checkbox label element to reply form footer element if (!empty($this->setup->userEmail) or $this->setup->userIsLoggedIn === false) { $reply_form_footer->appendChild($this->subscribeLabel($permalink, 'reply', $subscribed)); } // Create wrapper for form buttons $reply_form_buttons_wrapper = new HTMLTag('span'); $reply_form_buttons_wrapper->createAttribute('class', 'hashover-form-buttons'); // Create "Cancel" link element if ($this->setup->usesCancelButtons) { $reply_cancel_button = new HTMLTag('a', false, false); $reply_cancel_button->createAttribute('href', $this->setup->parsedURL['path']); // Add URL queries to link reference if (!empty($this->setup->URLQueries)) { $reply_cancel_button->appendAttribute('href', '?' . $this->setup->URLQueries, false); } // Add ID attribute with JavaScript variable single quote break out if (!empty($permalink)) { $reply_cancel_button->createAttribute('id', 'hashover-reply-cancel-' . $this->injectVar($permalink)); } // Continue with other attibutes $reply_cancel_button->appendAttribute('href', '#' . $this->injectVar($permalink), false); $reply_cancel_button->createAttribute('class', 'hashover-submit'); $reply_cancel_button->appendAttribute('class', 'hashover-reply-cancel'); $reply_cancel_button->createAttribute('title', $this->locales->locale('cancel', $this->addcslashes)); $reply_cancel_button->innerHTML($this->locales->locale('cancel', $this->addcslashes)); // Add "Cancel" link element to reply form footer element $reply_form_buttons_wrapper->appendChild($reply_cancel_button); } // Create "Post Comment" button element $reply_post_button = new HTMLTag('input', true); // Add ID attribute with JavaScript variable single quote break out if (!empty($permalink)) { $reply_post_button->createAttribute('id', 'hashover-reply-post-' . $this->injectVar($permalink)); } // Continue with other attibutes $reply_post_button->createAttribute('class', 'hashover-submit'); $reply_post_button->appendAttribute('class', 'hashover-reply-post'); $reply_post_button->createAttribute('type', 'submit'); $reply_post_button->createAttribute('name', 'post'); $reply_post_button->createAttribute('value', $this->locales->locale('post_reply', $this->addcslashes)); $reply_post_button->createAttribute('title', $this->locales->locale('post_reply', $this->addcslashes)); // Add "Post Comment" element to reply form footer element $reply_form_buttons_wrapper->appendChild($reply_post_button); // Add reply form buttons wrapper to reply form footer element $reply_form_footer->appendChild($reply_form_buttons_wrapper); // Add reply form footer to reply form element $reply_form->appendChild($reply_form_footer); return $reply_form->asHTML(); }