• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP serendipity_plugin_api类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: cleanup

 function cleanup()
 {
     $err = false;
     $bugp = $this->get_config('bugpath');
     $path = $this->get_config('path');
     // allow numeric client ID only
     if ($err = preg_match("/^[^0-9]+\$/", $this->get_config('client_id'))) {
         printf("%s%s%s", S9YPOT_ERR_START, S9YPOT_CID_ERROR, S9YPOT_ERR_END);
     }
     // webbug path must be absolute, no trailing slash
     if (!empty($bugp) && ($err = !preg_match("/^http(.*)[^\\/]\$/", $bugp))) {
         printf("%s%s%s", S9YPOT_ERR_START, S9YPOT_BUGURL_ERROR, S9YPOT_ERR_END);
     }
     // path must be absolute, no trailing slash
     if (!empty($path) && ($err = !preg_match("/^[\\/].*[^\\/]\$/", $path))) {
         printf("%s%s%s", S9YPOT_ERR_START, S9YPOT_PATH_ERROR, S9YPOT_ERR_END);
     }
     // check for an existing POT installation
     $location = sprintf("%s/%s", $this->get_config('path'), $this->get_config('fname'));
     if (!empty($path) && ($err = !file_exists($location))) {
         printf("%s%s%s", S9YPOT_ERR_START, S9YPOT_FNAME_ERROR, S9YPOT_ERR_END);
     }
     // s9y plugin error messaging is quite sub-optimal, print explanation what happened
     // reset all config values so nothing gets logged using a wrong client ID (logging will fail due to wrong path)
     if ($err || empty($bugp) && empty($path)) {
         $this->set_config('client_id', S9YPOT_DEFAULT_CID);
         $this->set_config('path', S9YPOT_DEFAULT_PATH);
         $this->set_config('fname', S9YPOT_DEFAULT_FNAME);
         $this->set_config('bugpath', S9YPOT_BUGDEFAULT_FNAME);
         printf("%s%s%s", S9YPOT_ERR_START, S9YPOT_ERR_RESET, S9YPOT_ERR_END);
     }
     serendipity_plugin_api::remove_plugin_value($this->instance, array('path', 'fname', 'client_id', 'bugpath'));
 }
开发者ID:sqall01,项目名称:additional_plugins,代码行数:33,代码来源:serendipity_event_phpopentracker.php


示例2: generate_content

    function generate_content(&$title)
    {
        global $serendipity;
        $title = $this->title;
        $fullentry = serendipity_db_bool($this->get_config('fullentry', 'true'));
        ?>
<form id="searchform" action="<?php 
        echo $serendipity['serendipityHTTPPath'] . $serendipity['indexFile'];
        ?>
" method="get">
    <div>
        <input type="hidden" name="serendipity[action]" value="search" />
        <input type="hidden" name="serendipity[fullentry]" value="<?php 
        echo $fullentry;
        ?>
" />
        <input type="text" id="serendipityQuickSearchTermField" name="serendipity[searchTerm]" size="13" />
        <input class="quicksearch_submit" type="submit" value="&gt;" name="serendipity[searchButton]" title="<?php 
        echo GO;
        ?>
" style="width: 2em;" />
    </div>
    <div id="LSResult" style="display: none;"><div id="LSShadow"></div></div>
</form>
<?php 
        serendipity_plugin_api::hook_event('quicksearch_plugin', $serendipity);
    }
开发者ID:amirchrist,项目名称:Serendipity,代码行数:27,代码来源:serendipity_plugin_quicksearch.php


示例3: generate_content

 function generate_content(&$title)
 {
     global $serendipity;
     $title = $this->get_config('title', $this->title);
     $eventData = array('display_dat' => '');
     serendipity_plugin_api::hook_event('frontend_display:html_layout', $eventData);
     echo $eventData['display_dat'];
 }
开发者ID:vonnordmann,项目名称:Serendipity,代码行数:8,代码来源:serendipity_plugin_creativecommons.php


示例4: showSearch

 function showSearch()
 {
     global $serendipity;
     $this->setupDB();
     $term = serendipity_db_escape_string($serendipity['GET']['searchTerm']);
     if ($serendipity['dbType'] == 'postgres') {
         $group = '';
         $distinct = 'DISTINCT';
         $find_part = "(c.title ILIKE '%{$term}%' OR c.body ILIKE '%{$term}%')";
     } elseif ($serendipity['dbType'] == 'sqlite') {
         $group = 'GROUP BY id';
         $distinct = '';
         $term = serendipity_mb('strtolower', $term);
         $find_part = "(lower(c.title) LIKE '%{$term}%' OR lower(c.body) LIKE '%{$term}%')";
     } else {
         $group = 'GROUP BY id';
         $distinct = '';
         $term = str_replace('&quot;', '"', $term);
         if (preg_match('@["\\+\\-\\*~<>\\(\\)]+@', $term)) {
             $find_part = "MATCH(c.title,c.body) AGAINST('{$term}' IN BOOLEAN MODE)";
         } else {
             $find_part = "MATCH(c.title,c.body) AGAINST('{$term}')";
         }
     }
     $querystring = "SELECT c.title AS ctitle, c.body, c.author, c.entry_id, c.timestamp AS ctimestamp, c.url, c.type,\n                               e.id, e.title, e.timestamp\n                          FROM {$serendipity['dbPrefix']}comments AS c\n               LEFT OUTER JOIN {$serendipity['dbPrefix']}entries AS e\n                            ON e.id = c.entry_id\n                         WHERE c.status = 'approved'\n                           AND {$find_part}\n                               {$group}\n                      ORDER BY c.timestamp DESC";
     $results = serendipity_db_query($querystring, false, 'assoc');
     if (!is_array($results)) {
         if ($results !== 1 && $results !== true) {
             echo function_exists('serendipity_specialchars') ? serendipity_specialchars($results) : htmlspecialchars($results, ENT_COMPAT, LANG_CHARSET);
         }
         $results = array();
     }
     $myAddData = array("from" => "serendipity_plugin_commentsearch:generate_content");
     foreach ($results as $idx => $result) {
         $results[$idx]['permalink'] = serendipity_archiveURL($result['id'], $result['title'], 'baseURL', true, $result);
         $results[$idx]['comment'] = $result['body'];
         //(function_exists('serendipity_specialchars') ? serendipity_specialchars(strip_tags($result['body'])) : htmlspecialchars(strip_tags($result['body']), ENT_COMPAT, LANG_CHARSET));
         serendipity_plugin_api::hook_event('frontend_display', $results[$idx], $myAddData);
         // let the template decide, if we want to have tags or not
         $results[$idx]['commenthtml'] = $results[$idx]['comment'];
         $results[$idx]['comment'] = strip_tags($results[$idx]['comment']);
     }
     $serendipity['smarty']->assign(array('comment_searchresults' => count($results), 'comment_results' => $results));
     $filename = 'plugin_commentsearch_searchresults.tpl';
     $tfile = serendipity_getTemplateFile($filename, 'serendipityPath');
     if (!$tfile) {
         $tfile = dirname(__FILE__) . '/' . $filename;
     }
     $inclusion = $serendipity['smarty']->security_settings[INCLUDE_ANY];
     $serendipity['smarty']->security_settings[INCLUDE_ANY] = true;
     $content = $serendipity['smarty']->fetch('file:' . $tfile);
     $serendipity['smarty']->security_settings[INCLUDE_ANY] = $inclusion;
     echo $content;
 }
开发者ID:sqall01,项目名称:additional_plugins,代码行数:54,代码来源:serendipity_event_commentsearch.php


示例5: show

 function show()
 {
     global $serendipity;
     $include_file = realpath($this->get_config('include'));
     ob_start();
     include $include_file;
     $content = ob_get_contents();
     ob_end_clean();
     if (serendipity_db_bool($this->get_config('markup'))) {
         $entry = array('body' => $content);
         serendipity_plugin_api::hook_event('frontend_display', $entry);
         echo $entry['body'];
     } else {
         echo $content;
     }
 }
开发者ID:sqall01,项目名称:additional_plugins,代码行数:16,代码来源:serendipity_plugin_externalphp.php


示例6: generate_content

 function generate_content(&$title)
 {
     $plug = $this->get_config('event_plugin', 'false');
     if ($plug == 'false') {
         return;
     }
     $wrap =& serendipity_plugin_api::get_event_plugins($plug);
     $faketitle = '';
     if (is_object($wrap)) {
         $wrap->generate_content($faketitle);
     }
     if ($this->get_config('title') != '') {
         $title = $this->get_config('title');
     } else {
         $title = $faketitle;
     }
 }
开发者ID:vonnordmann,项目名称:Serendipity,代码行数:17,代码来源:serendipity_plugin_eventwrapper.php


示例7: uninstall

 function uninstall(&$propbag)
 {
     global $serendipity;
     serendipity_plugin_api::hook_event('backend_cache_purge', $this->title);
     serendipity_plugin_api::hook_event('backend_cache_entries', $this->title);
     // delete directory with external images from articles
     $upload_dir = $serendipity['serendipityPath'] . $serendipity['uploadPath'] . 'plugin_mobile_output/';
     if (is_dir($upload_dir)) {
         // delete all files in the upload directory
         $files = glob($upload_dir . '*');
         if (is_array($files) && !empty($files)) {
             foreach ($files as $file) {
                 @unlink($file);
             }
         }
         @rmdir($upload_dir);
     }
 }
开发者ID:sqall01,项目名称:additional_plugins,代码行数:18,代码来源:serendipity_event_mobile_output.php


示例8: generate_content

 function generate_content(&$title)
 {
     global $serendipity;
     $title = $this->get_config('title');
     $show_where = $this->get_config('show_where', 'both');
     if ($show_where == 'extended' && (!isset($serendipity['GET']['id']) || !is_numeric($serendipity['GET']['id']))) {
         return false;
     } else {
         if ($show_where == 'overview' && isset($serendipity['GET']['id']) && is_numeric($serendipity['GET']['id'])) {
             return false;
         }
     }
     if ($this->get_config('markup', 'true') == 'true') {
         $entry = array('html_nugget' => $this->get_config('content'));
         serendipity_plugin_api::hook_event('frontend_display', $entry);
         echo $entry['html_nugget'];
     } else {
         echo $this->get_config('content');
     }
 }
开发者ID:vonnordmann,项目名称:Serendipity,代码行数:20,代码来源:serendipity_plugin_html_nugget.php


示例9: showPaging

 function showPaging($id = false)
 {
     global $serendipity;
     if (!$id) {
         return false;
     }
     $links = array();
     $cond = array();
     $cond['and'] = " AND e.isdraft = 'false' AND e.timestamp <= " . serendipity_serverOffsetHour(time(), true);
     serendipity_plugin_api::hook_event('frontend_fetchentry', $cond);
     $querystring = "SELECT\n                                e.id, e.title, e.timestamp\n                          FROM\n                                {$serendipity['dbPrefix']}entries e\n                                {$cond['joins']}\n                         WHERE\n                                e.id [COMP] " . (int) $id . "\n                                {$cond['and']}\n                        ORDER BY e.id [ORDER]\n                        LIMIT  1";
     $prevID = serendipity_db_query(str_replace(array('[COMP]', '[ORDER]'), array('<', 'DESC'), $querystring));
     $nextID = serendipity_db_query(str_replace(array('[COMP]', '[ORDER]'), array('>', 'ASC'), $querystring));
     if ($link = $this->makeLink($prevID)) {
         $links['prev'] = $link;
     }
     if ($link = $this->makeLink($nextID)) {
         $links['next'] = $link;
     }
     return $links;
 }
开发者ID:sqall01,项目名称:additional_plugins,代码行数:21,代码来源:serendipity_event_linktoolbar.php


示例10: array

 */
$serendipity['permissionLevels'] = array(USERLEVEL_EDITOR => USERLEVEL_EDITOR_DESC, USERLEVEL_CHIEF => USERLEVEL_CHIEF_DESC, USERLEVEL_ADMIN => USERLEVEL_ADMIN_DESC);
/*
 *  Check if the installed version is higher than the version of the config
 */
if (IS_up2date === false && !defined('IN_upgrader')) {
    if (preg_match(PAT_CSS, $_SERVER['REQUEST_URI'], $matches)) {
        $css_mode = 'serendipity_admin.css';
        return 1;
    }
    serendipity_die(sprintf(SERENDIPITY_NEEDS_UPGRADE, $serendipity['versionInstalled'], $serendipity['version'], $serendipity['serendipityHTTPPath'] . 'serendipity_admin.php'));
}
// We don't care who tells us what to do
if (!isset($serendipity['GET']['action'])) {
    $serendipity['GET']['action'] = isset($serendipity['POST']['action']) ? $serendipity['POST']['action'] : '';
}
if (!isset($serendipity['GET']['adminAction'])) {
    $serendipity['GET']['adminAction'] = isset($serendipity['POST']['adminAction']) ? $serendipity['POST']['adminAction'] : '';
}
// Some stuff...
if (!isset($_SESSION['serendipityAuthedUser'])) {
    $_SESSION['serendipityAuthedUser'] = false;
}
if (isset($_SESSION['serendipityUser'])) {
    $serendipity['user'] = $_SESSION['serendipityUser'];
}
if (isset($_SESSION['serendipityEmail'])) {
    $serendipity['email'] = $_SESSION['serendipityEmail'];
}
serendipity_plugin_api::hook_event('frontend_configure', $serendipity);
/* vim: set sts=4 ts=4 expandtab : */
开发者ID:rustyx,项目名称:Serendipity,代码行数:31,代码来源:serendipity_config.inc.php


示例11: uninstall

 function uninstall()
 {
     serendipity_plugin_api::hook_event('backend_cache_purge', $this->title);
     serendipity_plugin_api::hook_event('backend_cache_entries', $this->title);
 }
开发者ID:rustyx,项目名称:Serendipity,代码行数:5,代码来源:serendipity_event_xhtmlcleanup.php


示例12: show

 function show()
 {
     global $serendipity;
     if ($this->selected()) {
         if (!headers_sent()) {
             header('HTTP/1.0 200');
             header('Status: 200 OK');
         }
         if (!is_object($serendipity['smarty'])) {
             serendipity_smarty_init();
         }
         $_ENV['staticpage_pagetitle'] = preg_replace('@[^a-z0-9]@i', '_', $this->get_config('pagetitle'));
         $serendipity['smarty']->assign('staticpage_pagetitle', $_ENV['staticpage_pagetitle']);
         if ($this->get_config('articleformat') == TRUE) {
             echo '<div class="serendipity_Entry_Date">
                      <h3 class="serendipity_date">' . $this->get_config('pagetitle') . '</h3>';
         }
         echo '<h4 class="serendipity_title"><a href="#">' . $this->get_config('headline') . '</a></h4>';
         if ($this->get_config('articleformat') == TRUE) {
             echo '<div class="serendipity_entry"><div class="serendipity_entry_body">';
         }
         $include_file = realpath($this->get_config('include'));
         ob_start();
         include $include_file;
         $content = ob_get_contents();
         ob_end_clean();
         if ($this->get_config('markup') == TRUE) {
             $entry = array('body' => $content);
             serendipity_plugin_api::hook_event('frontend_display', $entry);
             echo $entry['body'];
         } else {
             echo $content;
         }
         if ($this->get_config('articleformat') == TRUE) {
             echo '</div></div></div>';
         }
     }
 }
开发者ID:sqall01,项目名称:additional_plugins,代码行数:38,代码来源:serendipity_event_externalphp.php


示例13: generate_content

 function generate_content(&$title)
 {
     global $serendipity;
     $title = $this->get_config('title', $this->title);
     $max_entries = $this->get_config('max_entries');
     $max_chars = $this->get_config('max_chars');
     $wordwrap = $this->get_config('wordwrap');
     $dateformat = $this->get_config('dateformat');
     if (!$max_entries || !is_numeric($max_entries) || $max_entries < 1) {
         $max_entries = 15;
     }
     if (!$max_chars || !is_numeric($max_chars) || $max_chars < 1) {
         $max_chars = 120;
     }
     if (!$wordwrap || !is_numeric($wordwrap) || $wordwrap < 1) {
         $wordwrap = 30;
     }
     if (!$dateformat || strlen($dateformat) < 1) {
         $dateformat = '%a, %d.%m.%Y %H:%M';
     }
     $viewtype = '';
     if ($this->get_config('viewmode') == 'comments') {
         $viewtype .= ' AND co.type = \'NORMAL\'';
     } elseif ($this->get_config('viewmode') == 'trackbacks') {
         $viewtype .= ' AND (co.type = \'TRACKBACK\' OR co.type = \'PINGBACK\')';
     }
     $cond = array();
     $cond['and'] = ' AND e.isdraft = \'false\' ';
     if ($this->get_config('authorid') == 'login') {
         serendipity_ACL_SQL($cond, true);
         serendipity_plugin_api::hook_event('frontend_fetchentries', $cond, array('source' => 'entries'));
     }
     $q = 'SELECT    co.body              AS comment,
                     co.timestamp         AS stamp,
                     co.author            AS user,
                     e.title              AS subject,
                     e.timestamp          AS entrystamp,
                     e.id                 AS entry_id,
                     co.id                AS comment_id,
                     co.type              AS comment_type,
                     co.url               AS comment_url,
                     co.title             AS comment_title,
                     co.email             AS comment_email
             FROM    ' . $serendipity['dbPrefix'] . 'comments AS co,
                     ' . $serendipity['dbPrefix'] . 'entries  AS e
                     ' . $cond['joins'] . '
            WHERE    e.id = co.entry_id
              AND    NOT (co.type = \'TRACKBACK\' AND co.author = \'' . serendipity_db_escape_string($serendipity['blogTitle']) . '\' AND co.title != \'\')
              AND    co.status = \'approved\'
                     ' . $viewtype . '
                     ' . $cond['and'] . '
         ORDER BY    co.timestamp DESC
         LIMIT ' . $max_entries;
     $sql = serendipity_db_query($q);
     // echo $q;
     if ($sql && is_array($sql)) {
         foreach ($sql as $key => $row) {
             if (function_exists('mb_strimwidth')) {
                 $comment = mb_strimwidth(strip_tags($row['comment']), 0, $max_chars, " [...]", LANG_CHARSET);
             } else {
                 $comments = wordwrap(strip_tags($row['comment']), $max_chars, '@@@', 1);
                 $aComment = explode('@@@', $comments);
                 $comment = $aComment[0];
                 if (count($aComment) > 1) {
                     $comment .= ' [...]';
                 }
             }
             $showurls = $this->get_config('showurls', 'trackbacks');
             $isTrackBack = $row['comment_type'] == 'TRACKBACK' || $row['comment_type'] == 'PINGBACK';
             if ($row['comment_url'] != '' && ($isTrackBack && ($showurls == 'trackbacks' || $showurls == 'all') || !$isTrackBack && ($showurls == 'comments' || $showurls == 'all'))) {
                 /* Fix invalid cases in protocoll part */
                 $row['comment_url'] = preg_replace('@^http://@i', 'http://', $row['comment_url']);
                 $row['comment_url'] = preg_replace('@^https://@i', 'https://', $row['comment_url']);
                 if (substr($row['comment_url'], 0, 7) != 'http://' && substr($row['comment_url'], 0, 8) != 'https://') {
                     $row['comment_url'] = 'http://' . $row['comment_url'];
                 }
                 $user = '<a class="highlight" href="' . htmlspecialchars(strip_tags($row['comment_url'])) . '" title="' . htmlspecialchars(strip_tags($row['comment_title'])) . '">' . htmlspecialchars(strip_tags($row['user'])) . '</a>';
             } else {
                 $user = htmlspecialchars(strip_tags($row['user']));
             }
             $user = trim($user);
             if (empty($user)) {
                 $user = PLUGIN_COMMENTS_ANONYMOUS;
             }
             if (function_exists('mb_strimwidth')) {
                 $pos = 0;
                 $parts = array();
                 $enc = LANG_CHARSET;
                 $comment_len = mb_strlen($comment, $enc);
                 while ($pos < $comment_len) {
                     $part = mb_strimwidth($comment, $pos, $wordwrap, '', $enc);
                     $pos += mb_strlen($part, $enc);
                     $parts[] = $part;
                 }
                 $comment = implode("\n", $parts);
             } else {
                 $comment = wordwrap($comment, $wordwrap, "\n", 1);
             }
             $entry = array('comment' => $comment, 'email' => $row['comment_email'], 'url' => $row['comment_url'], 'author' => $row['user']);
             // Let's help the BBCOde plugin a bit:
//.........这里部分代码省略.........
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:101,代码来源:serendipity_plugin_comments.php


示例14: die

<?php

// Contributed by Christian Machmeier <[email protected]>
// Randomizing contributed by Christian Brabandt <[email protected]>
if (IN_serendipity !== true) {
    die("Don't hack!");
}
@serendipity_plugin_api::load_language(dirname(__FILE__));
class serendipity_plugin_recententries extends serendipity_plugin
{
    var $title = PLUGIN_RECENTENTRIES_TITLE;
    function introspect(&$propbag)
    {
        $this->title = $this->get_config('title', $this->title);
        $propbag->add('name', PLUGIN_RECENTENTRIES_TITLE);
        $propbag->add('description', PLUGIN_RECENTENTRIES_BLAHBLAH);
        $propbag->add('stackable', true);
        $propbag->add('author', 'Christian Machmeier, Christian Brabandt, Judebert, Don Chambers');
        $propbag->add('version', '2.6');
        $propbag->add('requirements', array('serendipity' => '1.6', 'smarty' => '2.6.7', 'php' => '4.1.0'));
        $propbag->add('configuration', array('title', 'number', 'number_from', 'dateformat', 'category', 'randomize', 'show_where'));
        $propbag->add('groups', array('FRONTEND_VIEWS'));
    }
    function introspect_config_item($name, &$propbag)
    {
        global $serendipity;
        switch ($name) {
            case 'title':
                $propbag->add('type', 'string');
                $propbag->add('name', TITLE);
                $propbag->add('description', TITLE_FOR_NUGGET);
开发者ID:jimjag,项目名称:Serendipity,代码行数:31,代码来源:serendipity_plugin_recententries.php


示例15: strtotime

 if (isset($serendipity['allowDateManipulation']) && $serendipity['allowDateManipulation'] && isset($serendipity['POST']['new_timestamp']) && $serendipity['POST']['new_timestamp'] != date(DATE_FORMAT_2, $serendipity['POST']['chk_timestamp'])) {
     // The user changed the timestamp, now set the DB-timestamp to the user's date
     $entry['timestamp'] = strtotime($serendipity['POST']['new_timestamp']);
     if ($entry['timestamp'] == -1) {
         echo DATE_INVALID . '<br />';
         // The date given by the user is not convertable. Reset the timestamp.
         $entry['timestamp'] = $serendipity['POST']['timestamp'];
     }
 }
 // Save server timezone in database always, so substract the offset we added for display; otherwise it would be added time and again
 if (!empty($entry['timestamp'])) {
     $entry['timestamp'] = serendipity_serverOffsetHour($entry['timestamp'], true);
 }
 // Save the entry, or just display a preview
 $use_legacy = true;
 serendipity_plugin_api::hook_event('backend_entry_iframe', $use_legacy);
 if ($use_legacy) {
     if ($serendipity['POST']['preview'] != 'true') {
         /* We don't need an iframe to save a draft */
         if ($serendipity['POST']['isdraft'] == 'true') {
             echo '<div class="serendipityAdminMsgSuccess"><img style="height: 22px; width: 22px; border: 0px; padding-right: 4px; vertical-align: middle" src="' . serendipity_getTemplateFile('admin/img/admin_msg_success.png') . '" alt="" />' . IFRAME_SAVE_DRAFT . '</div><br />';
             serendipity_updertEntry($entry);
         } else {
             if ($serendipity['use_iframe']) {
                 echo '<div class="serendipityAdminMsgSuccess"><img style="height: 22px; width: 22px; border: 0px; padding-right: 4px; vertical-align: middle" src="' . serendipity_getTemplateFile('admin/img/admin_msg_success.png') . '" alt="" />' . IFRAME_SAVE . '</div><br />';
                 serendipity_iframe_create('save', $entry);
             } else {
                 serendipity_iframe($entry, 'save');
             }
         }
     } else {
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:31,代码来源:entries.inc.php


示例16: array

/**
 * Gets all available media directories
 *
 * @return array
 *
 */
function &serendipity_getMediaPaths()
{
    global $serendipity;
    $aExclude = array("CVS" => true, ".svn" => true);
    serendipity_plugin_api::hook_event('backend_media_path_exclude_directories', $aExclude);
    $paths = array();
    $aResultSet = serendipity_traversePath($serendipity['serendipityPath'] . $serendipity['uploadPath'], '', false, NULL, 1, NULL, FALSE, $aExclude);
    foreach ($aResultSet as $sKey => $sFile) {
        if ($sFile['directory']) {
            array_push($paths, $sFile);
        }
        unset($aResultSet[$sKey]);
    }
    serendipity_directoryACL($paths, 'read');
    usort($paths, 'serendipity_sortPath');
    return $paths;
}
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:23,代码来源:functions_images.inc.php


示例17: fetchTwitter

 function fetchTwitter(&$eventData)
 {
     require_once S9Y_PEAR_PATH . 'HTTP/Request.php';
     // Was lastrun successfull?
     if (isset($this->avatarConfiguration['twitter_found']) && !$this->avatarConfiguration['twitter_found']) {
         return false;
     }
     // Let other plugins fill metadata. CommentSpice is perhaps able to fetch twitter infos.
     try {
         $original_url = $eventData['url'];
         $this->log("hook_event: avatar_fetch_userinfos");
         $askforData = array("type" => "twitter");
         serendipity_plugin_api::hook_event('avatar_fetch_userinfos', $eventData, $askforData);
     } catch (Exception $e) {
         $this->log($e);
     }
     if (empty($eventData['url'])) {
         return false;
     }
     $url = $eventData['url'];
     $eventData['url'] = $original_url;
     $parts = @parse_url($url);
     if (!is_array($parts)) {
         return false;
     }
     if ($parts['host'] == 'twitter.com' || $parts['host'] == 'www.twitter.com') {
         $path = trim($parts['path']);
         $dirs = explode('/', $path);
         $twittername = $dirs[1];
         //if ($twittername=='#!') $twittername = $dirs[2];
         $this->log("Twitteruser found ({$url}): {$twittername}");
         $twitter_search = 'http://search.twitter.com/search.atom?q=from%3A' . $twittername . '&rpp=1';
         serendipity_request_start();
         $req = new HTTP_Request($twitter_search);
         $req->sendRequest();
         $this->last_error = $req->getResponseCode();
         if ($req->getResponseCode() != 200) {
             $this->last_error = $req->getResponseCode();
             serendipity_request_end();
             $this->log("Twitter Error: {$this->last_error}");
             return false;
         }
         $response = trim($req->getResponseBody());
         serendipity_request_end();
         $parser = xml_parser_create();
         $vals = array();
         $index = array();
         $success = xml_parse_into_struct($parser, $response, $vals, $index);
         xml_parser_free($parser);
         if ($success) {
             foreach ($index['LINK'] as $index) {
                 if ($vals[$index]['attributes']['REL'] == 'image') {
                     $img_url = $vals[$index]['attributes']['HREF'];
                     $success = true;
                     break;
                 }
             }
             if ($success) {
                 $success = $this->saveAndResponseAvatar($eventData, $img_url);
             }
         }
         $this->avatarConfiguration['twitter_found'] = $success;
         return $success;
     }
     return false;
 }
开发者ID:amirchrist,项目名称:Serendipity,代码行数:66,代码来源:serendipity_event_gravatar.php


示例18: generate_content


//.........这里部分代码省略.........
                             $smarty_items['nasa_image'] = $c->getData('image');
                             break;
                     }
                     $content = $this->parseTemplate($tpl);
                 }
                 $this->debug('Caching Feed (' . strlen($content) . ' bytes)');
                 $fp = @fopen($feedcache, 'w');
                 if (trim($content) != '' && $fp) {
                     fwrite($fp, $content);
                     fclose($fp);
                     $this->debug('Feed cache written');
                 } else {
                     $this->debug('Could not write (empty?) cache.');
                     echo '<!-- Cache failed to ' . $feedcache . ' in ' . getcwd() . ' --><br />';
                     if (trim($content) == '') {
                         $this->debug('Getting old feedcache');
                         $content = @file_get_contents($feedcache);
                     }
                 }
                 $this->debug('RSS Plugin (Atom) finished.');
             } elseif ($feedtype == 'opml') {
                 // Touching the feedcache file will prevent loops of death when the RSS target is the same URI than our blog.
                 @touch($feedcache);
                 $opml = new s9y_remoterss_OPML();
                 $opmltree = $opml->parseOPML($rssuri);
                 if (OPMLDEBUG == 1) {
                     echo "\n<pre>\n";
                     print_r($opmltree);
                     echo "\n</pre>\n";
                 }
                 if ($opmltree['tag'] === 'opml') {
                     $head = $opml->getOPMLHead($opmltree);
                     $ownerName = $opml->getOPMLTag($head, 'ownerName');
                     $blogrolling = $ownerName != false ? $ownerName['value'] == 'Blogroll Owner' ? true : false : false;
                     $i = 0;
                     $content = '';
                     while (($showAll || $i < $number) && ($item = $opml->getOPMLOutlineAttr($opmltree, $i))) {
                         if (!empty($item['url'])) {
                             $url = $this->decode($item['url']);
                         } elseif (!empty($item['htmlUrl'])) {
                             $url = $this->decode($item['htmlUrl']);
                         } elseif (!empty($item['xmlUrl'])) {
                             $url = $this->decode($item['xmlUrl']);
                         } elseif (!empty($item['urlHTTP'])) {
                             $url = $this->decode($item['urlHTTP']);
                         } else {
                             $url = '';
                         }
                         if (!empty($item['text'])) {
                             $text = serendipity_specialchars($this->decode($item['text']));
                         } elseif (!empty($item['title'])) {
                             $text = serendipity_specialchars($this->decode($item['title']));
                         } elseif (!empty($item['description'])) {
                             $text = serendipity_specialchars($this->decode($item['description']));
                         } else {
                             $text = '';
                         }
                         if ($blogrolling === true && (!empty($text) || !empty($url))) {
                             $content .= '&bull; <a href="' . serendipity_specialchars($url) . '" ' . (!empty($target) ? 'target="' . $target . '"' : '') . ' title="' . $text . '">' . $text . "</a>";
                             if (isset($item['isRecent'])) {
                                 $content .= ' <span style="color: Red; ">*</span>';
                             }
                             $content .= "<br />";
                         } elseif (isset($item['type']) && $item['type'] == 'url' || !empty($url)) {
                             $content .= '&bull; <a href="' . serendipity_specialchars($url) . '" ' . (!empty($target) ? 'target="' . $target . '"' : '') . ' title="' . $text . '">' . $text . "</a>";
                             $content .= "<br />";
                         }
                         ++$i;
                     }
                     /* Pretend to be a html_nugget so we can apply markup events. */
                     if ($markup == 'true') {
                         $entry = array('html_nugget' => $content);
                         serendipity_plugin_api::hook_event('frontend_display', $entry);
                         $content = $entry['html_nugget'];
                     }
                     $fp = @fopen($feedcache, 'w');
                     if (trim($content) != '' && $fp) {
                         fwrite($fp, $content);
                         fclose($fp);
                     } else {
                         echo '<!-- Cache failed to ' . $feedcache . ' in ' . getcwd() . ' --><br />';
                         if (trim($content) == '') {
                             $content = @file_get_contents($feedcache);
                         }
                     }
                 } else {
                     echo '<!-- Not a valid OPML feed -->';
                 }
             } else {
                 echo '<!-- no valid feedtype -->';
             }
         } else {
             $this->debug('Got feed from cache ' . $feedcache);
             $content = file_get_contents($feedcache);
         }
         echo $content;
     } else {
         echo PLUGIN_REMOTERSS_NOURI;
     }
 }
开发者ID:vonnordmann,项目名称:Serendipity,代码行数:101,代码来源:serendipity_plugin_remoterss.php


示例19: print_entries

 function print_entries(&$entries)
 {
     $extended = true;
     $preview = false;
     $addData = array('extended' => $extended, 'preview' => $preview, 'no_scramble' => true);
     serendipity_plugin_api::hook_event('entry_display', $entries, $addData);
     /* pre-walk the array to collect them keyed by date */
     $bydate = array();
     if (!is_array($entries) || $entries[0] == false) {
         return;
     }
     $lastDate = '';
     for ($x = 0, $num_entries = count($entries); $x < $num_entries; $x++) {
         $d = $this->prep_out(serendipity_formatTime(DATE_FORMAT_ENTRY, $entries[$x]['timestamp']));
         $bydate[$d][] = $entries[$x];
     }
     foreach ($bydate as $date => $ents) {
         $header = $date;
         foreach ($ents as $x => $entry) {
             $this->print_entry($x, $entry, $header);
             $header = false;
         }
         // end for-loop (entries)
     }
     // end for-loop (dates)
 }
开发者ID:sqall01,项目名称:additional_plugins,代码行数:26,代码来源:serendipity_event_blogpdf.php


示例20: serendipity_emit_htmlarea_code

function serendipity_emit_htmlarea_code($item, $jsname, $spawnMulti = false)
{
    static $init = false;
    global $serendipity;
    if ($init && $spawnMulti) {
        return true;
    }
    if (isset($serendipity['wysiwyg']) && $serendipity['wysiwyg']) {
        $eventData = array('init' => &$init, 'item' => &$item, 'jsname' => &$jsname, 'skip' => false);
        serendipity_plugin_api::hook_event('backend_wysiwyg', $eventData);
        if ($eventData['skip']) {
            return true;
        }
        if (file_exists($serendipity['serendipityPath'] . 'htmlarea/XinhaCore.js')) {
            $xinha = true;
        } else {
            $xinha = false;
        }
        $xinha_custom = serendipity_getTemplateFile('my_custom.js', 'serendipityHTTPPath');
        if (empty($xinha_custom)) {
            $xinha_custom = 'htmlarea/my_custom.js';
        }
        if (!$init) {
            ?>
    <script type="text/javascript">
        _editor_url = "<?php 
            echo $serendipity['serendipityHTTPPath'] . 'htmlarea/';
            ?>
";
        _editor_lang = "<?php 
            echo $xinha ? $serendipity['lang'] : WYSIWYG_LANG;
            ?>
";
        _editor_skin = "silva";
        var editorref = '';
    </script>
    <?php 
            if ($xinha) {
                ?>
    <script type="text/javascript" src="htmlarea/XinhaCore.js"></script>
    <!-- This file can contain user customizations -->
    <script type="text/javascript" src="<?php 
                echo $xinha_custom;
                ?>
"></script>
    <?php 
            } else {
                ?>
    <script type="text/javascript" src="htmlarea/htmlarea.js"></script>
    <?php 
            }
        }
        $csscode = str_replace(array("\n", "'", "\r", "{LANG_DIRECTION}"), array('\\n', "\\'", "", defined('LANG_DIRECTION') ? LANG_DIRECTION : 'ltr'), file_get_contents(serendipity_getTemplateFile('style_fallback.css', 'serendipityPath')) . file_get_contents(serendipity_getTemplateFile('htmlarea.css', 'serendipityPath')));
        ?>
    <script type="text/javascript">
    // IF you want to enable HTMLArea's spellchecker, download the SpellChecker plugin from the HTMLArea homepage
    // (http://www.sourceforge.net/projects/itools-htmlarea) and uncomment the lines suffixed with ' // [SPELLCHECK]'
    // Note that the SpellChecker is a CGI-based application which needs setup in your Apache host ("Options +CGIExec")
    // Thanks to Randall for pointing this out!

    // HTMLArea.loadPlugin("SpellChecker"); // [SPELLCHECK]
	<?php 
    

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP server类代码示例发布时间:2022-05-23
下一篇:
PHP seo类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap