当前位置: 首页>>代码示例>>PHP>>正文


PHP serendipity_plugin_api::hook_event方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9:

            $admin_section = COMMENTS;
            break;
        case 'category':
        case 'categories':
            if (!serendipity_checkPermission('adminCategories')) {
                break;
            }
            include S9Y_INCLUDE_PATH . 'include/admin/category.inc.php';
            $admin_section = CATEGORIES;
            break;
        case 'logout':
            echo LOGGEDOUT;
            break;
        case 'event_display':
            if ($serendipity['no_create'] !== true) {
                serendipity_plugin_api::hook_event('backend_sidebar_entries_event_display_' . $serendipity['GET']['adminAction'], $serendipity);
            }
            break;
        case 'maintenance':
            include S9Y_INCLUDE_PATH . 'include/admin/maintenance.inc.php';
            $admin_section = MENU_MAINTENANCE;
            break;
        default:
            include S9Y_INCLUDE_PATH . 'include/admin/overview.inc.php';
            $admin_section = ADMIN_FRONTPAGE;
            break;
    }
    $main_content = ob_get_contents();
    ob_end_clean();
}
if ($ajax) {
开发者ID:smoeding,项目名称:Serendipity,代码行数:31,代码来源:serendipity_admin.php

示例10: event_hook

 function event_hook($event, &$bag, &$eventData, $addData = null)
 {
     global $serendipity;
     static $login_url = null;
     if ($login_url === null) {
         $login_url = $serendipity['baseURL'] . $serendipity['indexFile'] . '?/plugin/loginbox';
     }
     $hooks =& $bag->get('event_hooks');
     if (isset($hooks[$event])) {
         switch ($event) {
             case 'frontend_saveComment':
                 if (!isset($serendipity['csuccess'])) {
                     $serendipity['csuccess'] = 'true';
                 }
                 if (serendipity_db_bool($this->get_config('registered_only')) && !serendipity_userLoggedIn() && $addData['source2'] != 'adduser') {
                     $eventData = array('allow_comments' => false);
                     $serendipity['messagestack']['comments'][] = PLUGIN_ADDUSER_REGISTERED_ONLY_REASON;
                     return false;
                 }
                 if (serendipity_db_bool($this->get_config('registered_only')) && !$this->inGroup() && $addData['source2'] != 'adduser') {
                     $eventData = array('allow_comments' => false);
                     $serendipity['messagestack']['comments'][] = PLUGIN_ADDUSER_REGISTERED_ONLY_REASON;
                     return false;
                 }
                 if (serendipity_db_bool($this->get_config('true_identities')) && !serendipity_userLoggedIn()) {
                     $user = str_replace(" b", '', $addData['name']);
                     $user = serendipity_db_escape_string(preg_replace('@\\s+@', ' ', trim($user)));
                     $user = trim($user);
                     $authors = serendipity_db_query("SELECT authorid FROM {$serendipity['dbPrefix']}authors WHERE realname = '" . $user . "'");
                     if (is_array($authors) && isset($authors[0]['authorid'])) {
                         $eventData = array('allow_comments' => false);
                         $serendipity['messagestack']['comments'][] = sprintf(PLUGIN_ADDUSER_REGISTERED_CHECK_REASON, $login_url, 'onclick="javascript:loginbox = window.open(this.href, \'loginbox\', \'width=300,height=300,locationbar=no,menubar=no,personalbar=no,statusbar=yes,status=yes,toolbar=no\'); return false;"');
                     }
                 }
                 break;
             case 'external_plugin':
                 if ($eventData != 'loginbox') {
                     return true;
                 }
                 $out = array();
                 serendipity_plugin_api::hook_event('backend_login_page', $out);
                 serendipity_smarty_init();
                 $serendipity['smarty']->assign(array('loginform_add' => $out, 'loginform_url' => $login_url, 'loginform_user' => $_SESSION['serendipityUser'], 'loginform_mail' => $_SESSION['serendipityEmail'], 'close_window' => defined('LOGIN_ACTION'), 'is_logged_in' => serendipity_userLoggedIn(), 'is_error' => defined('LOGIN_ERROR')));
                 $filename = 'loginbox.tpl';
                 $tfile = serendipity_getTemplateFile($filename, 'serendipityPath');
                 if (!$tfile || $tfile == $filename) {
                     $tfile = dirname(__FILE__) . '/' . $filename;
                 }
                 $inclusion = $serendipity['smarty']->security_settings[INCLUDE_ANY];
                 $serendipity['smarty']->security_settings[INCLUDE_ANY] = true;
                 $serendipity['smarty']->display($tfile);
                 break;
             case 'frontend_display':
                 if (serendipity_db_bool($this->get_config('registered_only')) && !serendipity_userLoggedIn()) {
                     $serendipity['messagestack']['comments'][] = sprintf(PLUGIN_ADDUSER_REGISTERED_ONLY_REASON, $serendipity['baseURL'] . $serendipity['indexFile'] . '?serendipity[subpage]=adduser', $serendipity['baseURL'] . 'serendipity_admin.php');
                     $eventData['allow_comments'] = false;
                 }
                 break;
             case 'frontend_configure':
                 if (isset($serendipity['POST']['action']) && isset($serendipity['POST']['user']) && isset($serendipity['POST']['pass'])) {
                     serendipity_login();
                     if (serendipity_userLoggedIn()) {
                         define('LOGIN_ACTION', 'login');
                         header('X-s9y-auth: Login');
                     } else {
                         define('LOGIN_ERROR', true);
                     }
                 } elseif (isset($serendipity['POST']['action']) && isset($serendipity['POST']['logout'])) {
                     serendipity_logout();
                     if (!serendipity_userLoggedIn()) {
                         header('X-s9y-auth: Logout');
                         define('LOGIN_ACTION', 'logout');
                     }
                 }
                 if ((serendipity_db_bool($this->get_config('registered_only')) || serendipity_db_bool($this->get_config('true_identities'))) && $_SESSION['serendipityAuthedUser']) {
                     if (defined('IN_serendipity_admin') && $serendipity['GET']['adminAction'] == 'doEdit') {
                         // void
                     } else {
                         $serendipity['COOKIE']['name'] = isset($_SESSION['serendipityRealname']) ? $_SESSION['serendipityRealname'] : $_SESSION['serendipityUser'];
                         $serendipity['COOKIE']['email'] = $_SESSION['serendipityEmail'];
                         if ($serendipity['POST']['comment']) {
                             $serendipity['POST']['name'] = $serendipity['COOKIE']['name'];
                             $serendipity['POST']['email'] = $serendipity['COOKIE']['email'];
                         }
                     }
                 }
                 return true;
                 break;
             case 'entry_display':
                 if ($serendipity['GET']['subpage'] == 'adduser' || $serendipity['POST']['subpage'] == 'adduser' || !empty($serendipity['GET']['adduser_activation']) || !empty($this->clean_page)) {
                     if (is_array($eventData)) {
                         $eventData['clean_page'] = true;
                     }
                 }
                 break;
             case 'entries_header':
                 if ($serendipity['GET']['subpage'] == 'adduser' || $serendipity['POST']['subpage'] == 'adduser' || !empty($serendipity['GET']['adduser_activation'])) {
                     $this->clean_page = true;
                     $url = $serendipity['baseURL'] . $serendipity['indexFile'];
                     $hidden['subpage'] = 'adduser';
//.........这里部分代码省略.........
开发者ID:sqall01,项目名称:additional_plugins,代码行数:101,代码来源:serendipity_event_adduser.php

示例11: serendipity_saveComment

/**
 * Save a comment made by a visitor
 *
 * @access public
 * @param   int     The ID of an entry
 * @param   array   An array that holds the input data from the visitor
 * @param   string  The type of a comment (normal/trackback)
 * @param   string  Where did a comment come from? (internal|trackback|plugin)
 * @return  boolean Returns true if the comment could be added
 */
function serendipity_saveComment($id, $commentInfo, $type = 'NORMAL', $source = 'internal')
{
    global $serendipity;
    $query = "SELECT id, allow_comments, moderate_comments, last_modified, timestamp, title FROM {$serendipity['dbPrefix']}entries WHERE id = '" . (int) $id . "'";
    $ca = serendipity_db_query($query, true);
    $commentInfo['type'] = $type;
    $commentInfo['source'] = $source;
    serendipity_plugin_api::hook_event('frontend_saveComment', $ca, $commentInfo);
    if (!is_array($ca) || serendipity_db_bool($ca['allow_comments'])) {
        if ($GLOBALS['tb_logging']) {
            $fp = fopen('trackback2.log', 'a');
            fwrite($fp, '[' . date('d.m.Y H:i') . '] insert comment into DB' . "\n");
            fclose($fp);
        }
        $commentInfo['comment_cid'] = serendipity_insertComment($id, $commentInfo, $type, $source, $ca);
        $commentInfo['comment_id'] = $id;
        serendipity_plugin_api::hook_event('frontend_saveComment_finish', $ca, $commentInfo);
        return true;
    } else {
        if ($GLOBALS['tb_logging']) {
            $fp = fopen('trackback2.log', 'a');
            fwrite($fp, '[' . date('d.m.Y H:i') . '] discarding comment from DB' . "\n");
            fclose($fp);
        }
        return false;
    }
}
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:37,代码来源:functions_comments.inc.php

示例12: 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

示例13: 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

示例14: serendipity_getTemplateFile

    <br />
    <br />

    <h3><?php 
    echo EVENT_PLUGINS;
    ?>
</h3>
    <a href="?serendipity[adminModule]=plugins&amp;serendipity[adminAction]=addnew&amp;serendipity[type]=event" class="serendipityIconLink"><img src="<?php 
    echo serendipity_getTemplateFile('admin/img/install.png');
    ?>
" style="border: 0px none ; vertical-align: middle; display: inline;" alt="" /><?php 
    echo sprintf(CLICK_HERE_TO_INSTALL_PLUGIN, EVENT_PLUGIN);
    ?>
</a>
    <?php 
    serendipity_plugin_api::hook_event('backend_plugins_event_header', $serendipity);
    ?>
    <?php 
    show_plugins(true);
    ?>

    <?php 
    if (count($serendipity['memSnaps']) > 0) {
        ?>
    <h3>Memory Usage</h3>
    <div>
        <pre><?php 
        print_r($serendipity['memSnaps']);
        ?>
</pre>
    </div>
开发者ID:Juuro,项目名称:Dreamapp-Website,代码行数:31,代码来源:plugins.inc.php

示例15: serendipity_loadGlobalThemeOptions

/**
 * Load global available/configured options for a specific theme
 * into an array.
 *
 * @param   array   Referenced variable coming from the config.inc.php file, where the config values will be stored in
 * @param   array   Current template configuration
 * @return  array   Final return array with default values
 */
function serendipity_loadGlobalThemeOptions(&$template_config, &$template_loaded_config, $supported = array())
{
    global $serendipity;
    if ($supported['navigation']) {
        $navlinks = array();
        $conf_amount = array('var' => 'amount', 'name' => NAVLINK_AMOUNT, 'type' => 'string', 'default' => '5', 'scope' => 'global');
        // This always needs to be present, if not it could happen that the template options do have an older version of this variable
        $template_config[] = $conf_amount;
        if (!isset($template_loaded_config['amount']) || empty($template_loaded_config['amount'])) {
            $template_loaded_config['amount'] = $conf_amount['default'];
        }
        // Check if we are currently inside the admin interface.
        if ($serendipity['POST']['adminModule'] == 'templates' && $serendipity['POST']['adminAction'] == 'configure' && !empty($serendipity['POST']['template']['amount'])) {
            $template_loaded_config['amount'] = (int) $serendipity['POST']['template']['amount'];
        }
        for ($i = 0; $i < $template_loaded_config['amount']; $i++) {
            $navlinks[] = array('title' => $template_loaded_config['navlink' . $i . 'text'], 'href' => $template_loaded_config['navlink' . $i . 'url']);
            $template_config[] = array('var' => 'navlink' . $i . 'text', 'name' => NAV_LINK_TEXT . ' #' . ($i + 1), 'type' => 'string', 'default' => 'Link #' . ($i + 1), 'scope' => 'global');
            $template_config[] = array('var' => 'navlink' . $i . 'url', 'name' => NAV_LINK_URL . ' #' . ($i + 1), 'type' => 'string', 'default' => '#', 'scope' => 'global');
        }
        $serendipity['smarty']->assignByRef('navlinks', $navlinks);
    }
    // Forward thinking. ;-)
    serendipity_plugin_api::hook_event('backend_templates_globalthemeoptions', $template_config, $supported);
}
开发者ID:beealone,项目名称:Serendipity,代码行数:33,代码来源:functions_config.inc.php


注:本文中的serendipity_plugin_api::hook_event方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。