pri:discussion_feeds
اختلافات
عرض الاختلافات بين النسخة المختارة و النسخة الحالية من الصفحة.
جانبي المراجعة السابقةالمراجعة السابقةالمراجعة التالية | المراجعة السابقة | ||
pri:discussion_feeds [2009/06/12 23:51] – alsadi | pri:discussion_feeds [2015/04/23 03:21] (حالي) – تحرير خارجي 127.0.0.1 | ||
---|---|---|---|
سطر 1: | سطر 1: | ||
+ | ====== discussion feeds ====== | ||
+ | |||
+ | * http:// | ||
+ | * http:// | ||
+ | |||
+ | تقليد الوظيفة _getThreads() الموجودة في admin.php داخل discussion plugin | ||
+ | |||
+ | <code php> | ||
+ | function _getThreads() { | ||
+ | global $conf; | ||
+ | |||
+ | require_once(DOKU_INC.' | ||
+ | |||
+ | // returns the list of pages in the given namespace and it's subspaces | ||
+ | $items = array(); | ||
+ | search($items, | ||
+ | |||
+ | // add pages with comments to result | ||
+ | $result = array(); | ||
+ | foreach ($items as $item) { | ||
+ | $id = $item[' | ||
+ | |||
+ | // some checks | ||
+ | $file = metaFN($id, ' | ||
+ | if (!@file_exists($file)) continue; // skip if no comments file | ||
+ | |||
+ | $date = filemtime($file); | ||
+ | $result[] = array( | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ); | ||
+ | } | ||
+ | |||
+ | // finally sort by time of last comment | ||
+ | usort($result, | ||
+ | |||
+ | return $result; | ||
+ | } | ||
+ | |||
+ | |||
+ | function _getComments(& | ||
+ | $id = $thread[' | ||
+ | |||
+ | if (!$thread[' | ||
+ | if (!@file_exists($thread[' | ||
+ | |||
+ | $data = unserialize(io_readFile($thread[' | ||
+ | |||
+ | $thread[' | ||
+ | $thread[' | ||
+ | if (!$data[' | ||
+ | if (!$data[' | ||
+ | |||
+ | $result = array(); | ||
+ | foreach ($data[' | ||
+ | $this-> | ||
+ | } | ||
+ | |||
+ | if (empty($result)) return false; | ||
+ | else return $result; | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | يعني نعمل commentsfeed.php تحتوي على دالة ترتب ملفات .comments في ns حسب filemtime ثم تأخذ أحدث كذا واحدة (فلنقل 10) ثم تعمل unserialize | ||
+ | <code php> | ||
+ | $comment=$data[' | ||
+ | </ | ||
+ | يمكن معرفة التاريخ والاسم هكذا | ||
+ | <code php> | ||
+ | if (is_array($comment[' | ||
+ | $name = $comment[' | ||
+ | $mail = $comment[' | ||
+ | } else { // old format | ||
+ | $name = $comment[' | ||
+ | $mail = $comment[' | ||
+ | } | ||
+ | if (is_array($comment[' | ||
+ | $created | ||
+ | } else { // old format | ||
+ | $created | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | بعد معرفة تاريخ التعليقات نأخذ آخر كذا تعليق ثم نولد ال rss | ||
+ | ونخزن ملف .commentsfeed كي يتم تزويده إن كان أحدث من ملف .comments وإلا يولد بالطريقة أعلاه | ||
+ | |||
+ | ====== الخطوة الاولى ====== | ||
+ | معرفة الصفحات | ||
+ | * هل تصلح getRecent من changelog.php ؟ غالبا لا | ||
+ | |||
+ | http:// | ||
+ | * استخدام search من search.php | ||
+ | |||
+ | search($data, | ||
+ | |||
+ | http:// | ||
+ | |||
pri/discussion_feeds.txt · آخر تعديل: 2015/04/23 03:21 (تحرير خارجي)