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


PHP sp_create_slug函数代码示例

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


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

示例1: sp_profile_add_menu

function sp_profile_add_menu($menu, $name, $form, $order = 0, $display = 1, $auth = '')
{
    # sanitize before use
    $menu = sp_filter_title_save($menu);
    $slug = sp_create_slug($name, false);
    $name = sp_filter_title_save($name);
    $form = str_replace('\\', '/', $form);
    # sanitize for Win32 installs
    $display = (int) $display;
    $auth = sp_esc_str($auth);
    # get profile tabs
    $tabs = sp_profile_get_tabs();
    if (empty($tabs)) {
        return false;
    }
    # find the requested tab
    foreach ($tabs as &$tab) {
        $found = false;
        if ($tab['name'] == $menu) {
            # make sure the menu doesnt already exist on this tab
            if (isset($tab['menus']) && $tab['menus']) {
                foreach ($tab['menus'] as $thisMenu) {
                    if ($thisMenu['name'] == $name) {
                        return -1;
                    }
                }
            }
            # insert the new menu
            if (empty($order)) {
                $order = empty($tab['menus']) ? 0 : count($tab['menus']);
            }
            $newtab = array();
            $newtab['name'] = $name;
            $newtab['slug'] = $slug;
            $newtab['form'] = $form;
            $newtab['display'] = $display;
            $newtab['auth'] = $auth;
            sp_array_insert($tab['menus'], $newtab, $order);
            # make sure its compact
            $tab['menus'] = array_values($tab['menus']);
            # menu added so break out
            $found = true;
            break;
        }
    }
    # if tab wasnt found bail
    if (!$found) {
        return false;
    }
    # save the new profile tabs
    $result = sp_add_sfmeta('profile', 'tabs', $tabs);
    return $result;
}
开发者ID:Bakerpedia,项目名称:Developement_WPengine,代码行数:53,代码来源:sp-api-profile.php

示例2: spa_save_smileys_data

function spa_save_smileys_data()
{
    global $spPaths;
    check_admin_referer('forum-adminform_smileys', 'forum-adminform_smileys');
    $mess = '';
    # save the smileys
    $sfsmileys = array();
    $path = SF_STORE_DIR . '/' . $spPaths['smileys'] . '/';
    $smileyname = $_POST['smname'];
    for ($x = 0; $x < count($smileyname); $x++) {
        $file = $_POST['smfile'][$x];
        $path_info = pathinfo($path . $file);
        $fn = strtolower($path_info['filename']);
        if (file_exists($path . $file)) {
            if (empty($smileyname[$x])) {
                $smileyname[$x] = $fn;
            }
            $thisname = urldecode(sp_create_slug($smileyname[$x], false));
            $code = empty($_POST['smcode'][$x]) ? $fn : $_POST['smcode'][$x];
            $code = sp_create_slug($code, false);
            trim($code, ':');
            if (empty($code)) {
                $code = $thisname;
            }
            $code = ':' . $code . ':';
            $sfsmileys[$thisname][] = sp_filter_filename_save($_POST['smfile'][$x]);
            $sfsmileys[$thisname][] = $code;
            $sfsmileys[$thisname][] = isset($_POST['sminuse-' . $smileyname[$x]]) ? 1 : 0;
            $sfsmileys[$thisname][] = $x;
            if (isset($_POST['smbreak-newbreak-' . $x])) {
                $_POST['smbreak-' . $smileyname[$x]] = $_POST['smbreak-newbreak-' . $x];
            }
            $sfsmileys[$thisname][] = isset($_POST['smbreak-' . $smileyname[$x]]) ? 1 : 0;
        }
    }
    # load current saved smileys to get meta id
    $meta = sp_get_sfmeta('smileys', 'smileys');
    sp_update_sfmeta('smileys', 'smileys', $sfsmileys, $meta[0]['meta_id'], true);
    do_action('sph_component_smileys_save');
    $mess .= spa_text('Smileys component updated');
    return $mess;
}
开发者ID:ashanrupasinghe,项目名称:govforuminstalledlocal,代码行数:42,代码来源:spa-components-save.php

示例3: sp_delete_auth_cat

function sp_delete_auth_cat($id_or_name)
{
    # if its not id, lets get the id for easy removal of auth cat from auths
    if (!is_numeric($id_or_name)) {
        $slug = sp_create_slug($id_or_name, true, SFAUTHCATS, 'authcat_slug');
        $id_or_name = spdb_table(SFAUTHCATS, 'authcat_slug="' . $slug . '"', 'authcat_id');
    }
    # now lets delete the auth cat
    $success = spdb_query('DELETE FROM ' . SFAUTHCATS . " WHERE authcat_id={$id_or_name}");
    # if successful, need to remove that cat from the auths and replace with default
    if ($success) {
        spdb_query('UPDATE ' . SFAUTHS . " SET auth_cat=0 WHERE authcat_id={$id_or_name}");
    }
    return $success;
}
开发者ID:ashanrupasinghe,项目名称:govforuminstalledlocal,代码行数:15,代码来源:sp-api-auths.php

示例4: sp_move_post

function sp_move_post()
{
    global $spVars, $spGlobals, $spThisUser;
    # extract data from POST
    $postid = sp_esc_int($_POST['postid']);
    $oldtopicid = sp_esc_int($_POST['oldtopicid']);
    $oldforumid = sp_esc_int($_POST['oldforumid']);
    $action = sp_esc_str($_POST['moveop']);
    # determine op type - new or exsiting topic
    if (isset($_POST['makepostmove1']) || isset($_POST['makepostmove3'])) {
        # new topic move or exsiting topic move called from notification
        # extract data from POST
        $newforumid = sp_esc_int($_POST['forumid']);
        if (!sp_get_auth('move_posts', $oldforumid) || !sp_get_auth('move_posts', $newforumid)) {
            if (!is_user_logged_in()) {
                $msg = sp_text('Access denied - are you logged in?');
            } else {
                $msg = sp_text('Access denied - you do not have permission');
            }
            sp_notify(SPFAILURE, $msg);
            return;
        }
        if (empty($newforumid)) {
            sp_notify(SPFAILURE, sp_text('Post move abandoned as no forum was selected'));
            return;
        }
        if (isset($_POST['makepostmove1'])) {
            # create new topic for a new topic post move only
            $newtopicname = sp_filter_title_save(trim($_POST['newtopicname']), SFTOPICS, 'topic_name');
            if (empty($newtopicname)) {
                sp_notify(SPFAILURE, sp_text('Post move abandoned as no topic was defined'));
                return;
            }
            # start with creating the new topic
            $newtopicslug = sp_create_slug($newtopicname, true, SFTOPICS, 'topic_slug');
            # now create the topic and post records
            $sql = 'INSERT INTO ' . SFTOPICS . "\n\t\t\t\t (topic_name, topic_slug, topic_date, forum_id, post_count, post_id, post_count_held, post_id_held)\n\t\t\t\t VALUES\n\t\t\t\t ('{$newtopicname}', '{$newtopicslug}', now(), {$newforumid}, 1, {$postid}, 1, {$postid});";
            if (spdb_query($sql) == false) {
                sp_notify(SPFAILURE, sp_text('Post move failed'));
                return;
            }
            $newtopicid = $spVars['insertid'];
            # check the topic slug and if empty use the topic id
            if (empty($newtopicslug)) {
                $newtopicslug = 'topic-' . $newtopicid;
                $thistopic = spdb_query('UPDATE ' . SFTOPICS . " SET\n\t\t\t\t\t\t\t\t\t\ttopic_slug='{$newtopicslug}'\n\t\t\t\t\t\t\t\t\t\tWHERE topic_id={$newtopicid}");
            }
        } else {
            # it's a re-entry
            $newtopicid = sp_esc_int($_POST['newtopicid']);
        }
        # Now determine the list of post ids to move
        $posts = array();
        switch ($action) {
            case 'single':
                $posts[] = $postid;
                break;
            case 'tostart':
                $sql = "SELECT post_id FROM " . SFPOSTS . " WHERE topic_id = {$oldtopicid} AND post_id <= {$postid}";
                $posts = spdb_select('col', $sql);
                break;
            case 'toend':
                $sql = "SELECT post_id FROM " . SFPOSTS . " WHERE topic_id = {$oldtopicid} AND post_id >= {$postid}";
                $posts = spdb_select('col', $sql);
                break;
            case 'select':
                $idlist = sp_esc_str(trim($_POST['idlist'], ","));
                if (empty($idlist)) {
                    $posts[] = $postid;
                } else {
                    $where = "topic_id = {$oldtopicid} AND post_index IN ({$idlist})";
                    $sql = "SELECT post_id FROM " . SFPOSTS . " WHERE topic_id = {$oldtopicid} AND post_index IN ({$idlist})";
                    $posts = spdb_select('col', $sql);
                }
                break;
        }
        if (empty($posts)) {
            sp_notify(SPFAILURE, sp_text('Post move abandoned as no posts were selected'));
            return;
        }
        # loop through and update post records and other housekeeping
        foreach ($posts as $post) {
            # update post record
            $sql = 'UPDATE ' . SFPOSTS . " SET\n\t\t\t\t \ttopic_id={$newtopicid},\n\t\t\t\t \tforum_id={$newforumid},\n\t\t\t\t \tpost_status=0\n\t\t\t\t \tWHERE post_id={$post}";
            spdb_query($sql);
            # update post if in sfwaiting
            spdb_query("UPDATE " . SFWAITING . " SET forum_id={$newforumid}, topic_id={$newtopicid} WHERE post_id={$post}");
            # notify author of move
            $thisPost = spdb_table(SFPOSTS, "post_id={$post}", 'row');
            $sfadminsettings = sp_get_option('sfadminsettings');
            if ($sfadminsettings['movenotice'] && $spThisUser->ID != $thisPost->user_id) {
                $nData = array();
                $nData['user_id'] = $thisPost->user_id;
                $nData['guest_email'] = $thisPost->guest_email;
                $nData['post_id'] = $post;
                $nData['link'] = sp_permalink_from_postid($post);
                $nData['link_text'] = spdb_table(SFTOPICS, "topic_id={$thisPost->topic_id}", 'topic_name');
                $nData['message'] = sp_text('A post of yours was moved to');
                $nData['expires'] = time() + 30 * 24 * 60 * 60;
                # 30 days; 24 hours; 60 mins; 60secs
//.........这里部分代码省略.........
开发者ID:bself,项目名称:nuimage-wp,代码行数:101,代码来源:sp-db-management.php

示例5: sp_PostIndexUserMemberships

function sp_PostIndexUserMemberships($args = '', $noMembershipLabel = '', $adminLabel = '')
{
    global $spThisPost, $spThisPostUser, $spPaths;
    $defs = array('tagId' => 'spPostIndexUserMemberships%ID%', 'tagClass' => 'spPostUserMemberships', 'stacked' => 1, 'showTitle' => 1, 'showBadge' => 1, 'echo' => 1, 'get' => 0);
    $a = wp_parse_args($args, $defs);
    $a = apply_filters('sph_PostIndexUserMemberships_args', $a);
    extract($a, EXTR_SKIP);
    # sanitize before use
    $tagId = esc_attr($tagId);
    $tagClass = esc_attr($tagClass);
    $stacked = (int) $stacked;
    $showTitle = (int) $showTitle;
    $showBadge = (int) $showBadge;
    $echo = (int) $echo;
    $get = (int) $get;
    $tagId = str_ireplace('%ID%', $spThisPost->post_id, $tagId);
    if ($get) {
        return $spThisPostUser->memberships;
    }
    $show = false;
    $tout = "<div id='{$tagId}' class='{$tagClass}'>";
    if (!empty($spThisPostUser->memberships)) {
        $first = true;
        $split = $stacked ? '<br />' : ', ';
        foreach ($spThisPostUser->memberships as $membership) {
            if (!$first) {
                $tout .= $split;
            }
            if ($showBadge && !empty($membership['usergroup_badge'])) {
                $show = true;
                $tout .= "<img src='" . SF_STORE_URL . '/' . $spPaths['ranks'] . '/' . $membership['usergroup_badge'] . "' alt='' />";
                $tout .= '<br />';
            }
            if ($showTitle) {
                $show = true;
                $tout .= '<span class="spUserGroup-' . sp_create_slug($membership['usergroup_name'], false) . '">' . $membership['usergroup_name'] . '</span><br />';
            }
            $first = false;
        }
    } else {
        if ($spThisPostUser->admin) {
            if ($showTitle && !empty($adminLabel)) {
                $show = true;
                $tout .= sp_filter_title_display($adminLabel);
            }
        } else {
            if (!empty($noMembershipLabel)) {
                $show = true;
                $tout .= sp_filter_title_display($noMembershipLabel);
            }
        }
    }
    $tout .= "</div>\n";
    $out = $show ? $tout : '';
    $out = apply_filters('sph_PostIndexUserMemberships', $out, $a);
    if ($echo) {
        echo $out;
    } else {
        return $out;
    }
}
开发者ID:ashanrupasinghe,项目名称:govforuminstalledlocal,代码行数:61,代码来源:sp-topic-view-functions.php

示例6: sp_esc_int

if (isset($_GET['id'])) {
    $id = sp_esc_int($_GET['id']);
}
if (isset($_GET['title'])) {
    $title = sp_esc_str($_GET['title']);
}
if (isset($_GET['slugaction'])) {
    $slugaction = sp_esc_str($_GET['slugaction']);
}
if ($action == 'slug') {
    $checkdupes = true;
    if ($slugaction == 'edit') {
        $checkdupes = false;
    }
    $newslug = sp_create_slug($title, $checkdupes, SFFORUMS, 'forum_slug');
    $newslug = sp_create_slug($newslug, $checkdupes, SFWPPOSTS, 'post_name');
    # must also check WP posts table as WP can mistake forum slug for WP post
    echo $newslug;
}
if ($action == 'delicon') {
    global $spPaths;
    $file = sp_esc_str($_GET['file']);
    $path = SF_STORE_DIR . '/' . $spPaths['custom-icons'] . '/' . $file;
    @unlink($path);
}
if ($action == 'delimage') {
    global $spPaths;
    $file = sp_esc_str($_GET['file']);
    $path = SF_STORE_DIR . '/' . $spPaths['forum-images'] . '/' . $file;
    @unlink($path);
}
开发者ID:bself,项目名称:nuimage-wp,代码行数:31,代码来源:spa-ahah-forums.php

示例7: validateData


//.........这里部分代码省略.........
         $blockedGuest = sp_get_option('guest-name');
         if (!empty($blockedGuest)) {
             $names = explode(',', $blockedGuest);
             foreach ($names as $name) {
                 if (strtolower(trim($name)) == strtolower($this->newpost['guestname'])) {
                     $this->abort = true;
                     $this->message = sp_text('The guest name you have chosen is not allowed on this site');
                     return;
                 }
             }
         }
         # check that the guest name is not the same as a current user
         $checkdupe = spdb_table(SFMEMBERS, "display_name='" . $this->newpost['guestname'] . "'", 'display_name');
         if (!empty($checkdupe)) {
             $this->abort = true;
             $this->message = sp_text('This user name already belongs to a forum member');
             return;
         }
     }
     # Check if links allowed or if maxmium links have been exceeded
     $sffilters = sp_get_option('sffilters');
     if (!$this->admin) {
         $links = $this->count_links();
         if (sp_get_auth('create_links', $this->newpost['forumid'], $this->userid)) {
             if ($sffilters['sfmaxlinks'] > 0 && $links > $sffilters['sfmaxlinks']) {
                 $this->abort = true;
                 $this->message = sp_text('Maximum number of allowed links exceeded') . ': ' . $sffilters['sfmaxlinks'] . ' ' . sp_text('allowed');
                 return;
             }
         } else {
             if ($links > 0) {
                 $this->abort = true;
                 $this->message = sp_text('You are not allowed to put links in post content');
                 return;
             }
         }
     }
     # Check if maxmium smileys have been exceeded
     if (!$this->admin) {
         if (isset($sffilters['sfmaxsmileys']) && $sffilters['sfmaxsmileys'] > 0 && $this->count_smileys() > $sffilters['sfmaxsmileys']) {
             $this->abort = true;
             $this->message = sp_text('Maximum number of allowed smileys exceeded') . ': ' . $sffilters['sfmaxsmileys'] . ' ' . sp_text('allowed');
             return;
         }
     }
     # Check for duplicate post of option is set
     if ($this->member && $sffilters['sfdupemember'] == true || $this->guest && $sffilters['sfdupeguest'] == true) {
         # But not admin or moderator
         if (!$this->admin && !$this->moderator) {
             $dupecheck = spdb_table(SFPOSTS, 'forum_id = ' . $this->newpost['forumid'] . ' AND topic_id=' . $this->newpost['topicid'] . " AND post_content='" . $this->newpost['postcontent'] . "' AND poster_ip='" . $this->newpost['posterip'] . "'", 'row', '', '', ARRAY_A);
             if ($dupecheck) {
                 $this->abort = true;
                 $this->message = sp_text('Duplicate post refused');
                 return;
             }
         }
     }
     # Establish moderation status
     $bypassAll = sp_get_auth('bypass_moderation', $this->newpost['forumid'], $this->userid);
     $bypassOnce = sp_get_auth('bypass_moderation_once', $this->newpost['forumid'], $this->userid);
     if ($bypassAll == true && $bypassOnce == true) {
         $this->newpost['poststatus'] = 0;
     } else {
         if ($bypassAll == false && $bypassOnce == false) {
             $this->newpost['poststatus'] = 1;
         } else {
             if ($bypassAll == true && $bypassOnce == false) {
                 $this->newpost['poststatus'] = 1;
                 if ($this->member) {
                     $prior = spdb_table(SFPOSTS, 'user_id=' . $this->newpost['userid'] . ' AND post_status=0', 'row', '', '1');
                     if ($prior) {
                         $this->newpost['poststatus'] = 0;
                     }
                 } else {
                     if ($this->guest) {
                         $prior = spdb_table(SFPOSTS, "guest_name='" . $this->newpost['guestname'] . "' AND guest_email='" . $this->newpost['guestemail'] . "' AND post_status=0", 'row', '', '1');
                         if ($prior) {
                             $this->newpost['poststatus'] = 0;
                         }
                     }
                 }
             } else {
                 $this->newpost['poststatus'] = 1;
             }
         }
     }
     # Finally one or two other data items
     if ($this->action == 'topic') {
         $this->newpost['topicslug'] = sp_create_slug($this->newpost['topicname'], true, SFTOPICS, 'topic_slug');
     } else {
         $this->newpost['emailprefix'] = 'Re: ';
     }
     $this->newpost['groupname'] = sp_get_group_name_from_forum($this->newpost['forumid']);
     if (empty($this->newpost['forumname'])) {
         $this->newpost['forumname'] = spdb_table(SFFORUMS, "forum_slug='" . $this->newpost['forumslug'] . "'", 'forum_name');
     }
     $this->newpost = apply_filters('sph_post_data_validation', $this->newpost);
     do_action('sph_pre_post_create', $this->newpost);
     $this->newpost = apply_filters('sph_new_forum_post', $this->newpost);
 }
开发者ID:brooklyntri,项目名称:btc-plugins,代码行数:101,代码来源:sp-api-class-post.php

示例8: sp_track_online

function sp_track_online()
{
    global $spThisUser, $spVars, $spDevice;
    # dont track feed views
    if ($spVars['pageview'] == 'feed') {
        return;
    }
    # Update tracking
    if ($spThisUser->member) {
        # it's a member
        $trackUserId = $spThisUser->ID;
        $trackName = $spThisUser->user_login;
    } else {
        # Unknown guest
        $trackUserId = 0;
        $trackName = $spThisUser->ip;
    }
    $track = spdb_table(SFTRACK, "trackname='{$trackName}'", 'row');
    $now = current_time('mysql');
    $forumId = isset($spVars['forumid']) ? $spVars['forumid'] : 0;
    $topicId = isset($spVars['topicid']) ? $spVars['topicid'] : 0;
    $pageview = $spVars['pageview'];
    # handle sneak peek
    if (!empty($topicId)) {
        if (!sp_get_auth('view_forum', $forumId)) {
            return;
        }
    } else {
        if (!empty($forumId)) {
            if (!sp_can_view($forumId, 'topic-title')) {
                return;
            }
        }
    }
    # update or start tracking
    if ($track) {
        # they are still here
        spdb_query("UPDATE " . SFTRACK . "\n\t\t\t\t   SET trackdate='" . $now . "', forum_id=" . $forumId . ",  topic_id=" . $topicId . ", pageview='{$pageview}'\n\t\t\t\t   WHERE id=" . $track->id);
        if ($spThisUser->member) {
            sp_update_users_newposts();
        }
        $spThisUser->trackid = $track->id;
        $spThisUser->session_first_visit = false;
        $spThisUser->notification = $track->notification;
    } else {
        # newly arrived
        # set deice being used
        $device = 'D';
        switch ($spDevice) {
            case 'mobile':
                $device = 'M';
                break;
            case 'tablet':
                $device = 'T';
                break;
            case 'desktop':
                $device = 'D';
                break;
        }
        # display classes
        $display = 'spType-' . $spThisUser->usertype;
        if (!empty($spThisUser->rank)) {
            $display .= ' spRank-' . sp_create_slug($spThisUser->rank[0]['name'], false);
        }
        if (!empty($spThisUser->special_rank)) {
            foreach ($spThisUser->special_rank as $rank) {
                $display .= ' spSpecialRank-' . sp_create_slug($rank['name'], false);
            }
        }
        if (!empty($spThisUser->memberships)) {
            foreach ($spThisUser->memberships as $membership) {
                $display .= ' spUsergroup-' . sp_create_slug($membership['usergroup_name'], false);
            }
        }
        spdb_query("INSERT INTO " . SFTRACK . "\n\t\t\t \t   (trackuserid, trackname, forum_id, topic_id, trackdate, pageview, device, display) VALUES\n\t\t\t \t   ({$trackUserId}, '{$trackName}', {$forumId}, {$topicId}, '{$now}', '{$pageview}', '{$device}', '{$display}')");
        $spThisUser->trackid = $spVars['insertid'];
        $spThisUser->session_first_visit = true;
        if ($spThisUser->member) {
            sp_update_users_newposts();
        }
    }
    # Check for expired tracking - some may have left the scene
    $splogin = sp_get_option('sflogin');
    $timeout = $splogin['sptimeout'];
    if (!$timeout) {
        $timeout = 20;
    }
    $expired = spdb_table(SFTRACK, "trackdate < DATE_SUB('{$now}', INTERVAL {$timeout} MINUTE)");
    if ($expired) {
        # if any Members expired - update user meta
        foreach ($expired as $expire) {
            if ($expire->trackuserid > 0) {
                sp_set_last_visited($expire->trackuserid);
            }
        }
        # finally delete them
        spdb_query("DELETE FROM " . SFTRACK . "\n\t\t\t\t\tWHERE trackdate < DATE_SUB('{$now}', INTERVAL {$timeout} MINUTE)");
    }
}
开发者ID:Bakerpedia,项目名称:Developement_WPengine,代码行数:99,代码来源:sp-db-statistics.php

示例9: sp_SectionStart


//.........这里部分代码省略.........
            if (isset($spForumView)) {
                $rowClass .= $spForumView->currentTopic % 2 ? ' spOdd' : ' spEven';
            }
            if (isset($spThisTopic)) {
                if ($spThisTopic->topic_status) {
                    $rowClass .= ' spLockedTopic';
                }
                if ($spThisTopic->topic_pinned) {
                    $rowClass .= ' spPinnedTopic';
                }
                if ($spThisTopic->unread) {
                    $rowClass .= ' spUnreadPosts';
                }
                $rowId .= "topic{$spThisTopic->topic_id}";
            }
            break;
        case 'post':
            global $spThisUser, $spTopicView, $spThisTopic, $spThisPost;
            if (isset($spTopicView)) {
                $rowClass .= $spTopicView->currentPost % 2 ? ' spOdd' : ' spEven';
            }
            if (isset($spThisPost)) {
                if ($spThisPost->post_pinned) {
                    $rowClass .= ' spPinnedPost';
                }
                if ($spThisPost->new_post) {
                    $rowClass .= ' spUnreadPosts';
                }
                if ($spThisPost->post_index == 1) {
                    $rowClass .= ' spFirstPost';
                }
                $rowClass .= ' spType-' . $spThisPost->postUser->usertype;
                if (!empty($spThisPost->postUser->rank)) {
                    $rowClass .= ' spRank-' . sp_create_slug($spThisPost->postUser->rank[0]['name'], false);
                }
                if (!empty($spThisPost->postUser->special_rank)) {
                    foreach ($spThisPost->postUser->special_rank as $rank) {
                        $rowClass .= ' spSpecialRank-' . sp_create_slug($rank['name'], false);
                    }
                }
                if (!empty($spThisPost->postUser->memberships)) {
                    foreach ($spThisPost->postUser->memberships as $membership) {
                        $rowClass .= ' spUsergroup-' . sp_create_slug($membership['usergroup_name'], false);
                    }
                }
                if ($spThisPost->user_id) {
                    if ($spThisPost->user_id == $spThisUser->ID) {
                        $rowClass .= ' spCurUserPost';
                    } else {
                        $rowClass .= ' spUserPost';
                    }
                    if ($spThisTopic->topic_starter == $spThisPost->user_id) {
                        $rowClass .= ' spAuthorPost';
                    }
                } else {
                    $rowClass .= ' spGuestPost';
                }
                $rowId .= "post{$spThisPost->post_id}";
            }
            break;
        case 'list':
            global $spListView, $spThisListTopic;
            if (isset($spListView)) {
                $rowClass .= $spListView->currentTopic % 2 ? ' spOdd' : ' spEven';
            }
            if (isset($spThisListTopic)) {
开发者ID:Bakerpedia,项目名称:Developement_WPengine,代码行数:67,代码来源:sp-common-view-functions.php

示例10: spa_save_forums_edit_forum

function spa_save_forums_edit_forum()
{
    check_admin_referer('forum-adminform_forumedit', 'forum-adminform_forumedit');
    $forumdata = array();
    $forumdata['group_id'] = sp_esc_int($_POST['group_id']);
    if ($_POST['cparent'] == 0) {
        $forumdata['parent'] = 0;
    } else {
        $forumdata['parent'] = sp_esc_int($_POST['parent']);
    }
    if ($forumdata['parent'] != $_POST['cparent']) {
        $forumdata['group_id'] = spdb_table(SFFORUMS, 'forum_id=' . $forumdata['parent'], 'group_id');
    }
    $forum_id = sp_esc_int($_POST['forum_id']);
    $forumdata['forum_name'] = sp_filter_title_save(trim($_POST['forum_name']));
    if (!empty($_POST['cforum_slug'])) {
        $forumdata['forum_slug'] = sp_create_slug($_POST['cforum_slug'], false);
    } else {
        $forumdata['forum_slug'] = sp_create_slug($forumdata['forum_name'], true, SFFORUMS, 'forum_slug');
        $forumdata['forum_slug'] = sp_create_slug($forumdata['forum_slug'], true, SFWPPOSTS, 'post_name');
        # must also check WP posts table as WP can mistake forum slug for WP post
    }
    $forumdata['forum_desc'] = sp_filter_text_save(trim($_POST['forum_desc']));
    $forumdata['forum_status'] = 0;
    if (isset($_POST['forum_status'])) {
        $forumdata['forum_status'] = 1;
    }
    $forumdata['forum_rss_private'] = 0;
    if (isset($_POST['forum_private'])) {
        $forumdata['forum_rss_private'] = 1;
    }
    $forumdata['forum_keywords'] = sp_filter_title_save(trim($_POST['forum_keywords']));
    if (!empty($_POST['forum_icon'])) {
        # Check new icon exists
        $forumdata['forum_icon'] = sp_filter_title_save(trim($_POST['forum_icon']));
        $path = SFCUSTOMDIR . $forumdata['forum_icon'];
        if (!file_exists($path)) {
            $mess = sprintf(spa_text('Custom icon %s does not exist'), $forumdata['forum_icon']);
            return $mess;
        }
    } else {
        $forumdata['forum_icon'] = null;
    }
    if (!empty($_POST['forum_icon_new'])) {
        # Check new icon exists
        $forumdata['forum_icon_new'] = sp_filter_title_save(trim($_POST['forum_icon_new']));
        $path = SFCUSTOMDIR . $forumdata['forum_icon_new'];
        if (!file_exists($path)) {
            $mess = sprintf(spa_text('Custom icon %s does not exist'), $forumdata['forum_icon_new']);
            return $mess;
        }
    } else {
        $forumdata['forum_icon_new'] = null;
    }
    if (!empty($_POST['forum_icon_locked'])) {
        # Check new icon exists
        $forumdata['forum_icon_locked'] = sp_filter_title_save(trim($_POST['forum_icon_locked']));
        $path = SFCUSTOMDIR . $forumdata['forum_icon_locked'];
        if (!file_exists($path)) {
            $mess = sprintf(spa_text('Custom icon %s does not exist'), $forumdata['forum_icon_locked']);
            return $mess;
        }
    } else {
        $forumdata['forum_icon_locked'] = null;
    }
    if (!empty($_POST['topic_icon'])) {
        # Check new icon exists
        $forumdata['topic_icon'] = sp_filter_title_save(trim($_POST['topic_icon']));
        $path = SFCUSTOMDIR . $forumdata['topic_icon'];
        if (!file_exists($path)) {
            $mess = sprintf(spa_text('Custom icon %s does not exist'), $forumdata['topic_icon']);
            return $mess;
        }
    } else {
        $forumdata['topic_icon'] = null;
    }
    if (!empty($_POST['topic_icon_new'])) {
        # Check new icon exists
        $forumdata['topic_icon_new'] = sp_filter_title_save(trim($_POST['topic_icon_new']));
        $path = SFCUSTOMDIR . $forumdata['topic_icon_new'];
        if (!file_exists($path)) {
            $mess = sprintf(spa_text('Custom icon %s does not exist'), $forumdata['topic_icon_new']);
            return $mess;
        }
    } else {
        $forumdata['topic_icon_new'] = null;
    }
    if (!empty($_POST['topic_icon_locked'])) {
        # Check new icon exists
        $forumdata['topic_icon_locked'] = sp_filter_title_save(trim($_POST['topic_icon_locked']));
        $path = SFCUSTOMDIR . $forumdata['topic_icon_locked'];
        if (!file_exists($path)) {
            $mess = sprintf(spa_text('Custom icon %s does not exist'), $forumdata['topic_icon_locked']);
            return $mess;
        }
    } else {
        $forumdata['topic_icon_locked'] = null;
    }
    if (!empty($_POST['topic_icon_pinned'])) {
        # Check new icon exists
//.........这里部分代码省略.........
开发者ID:ashanrupasinghe,项目名称:govforuminstalledlocal,代码行数:101,代码来源:spa-forums-save.php

示例11: spa_paint_storage_input

function spa_paint_storage_input($label, $name, $value, $path, $na = false)
{
    global $tab, $tooltips, $spDevice;
    $found = false;
    $ok = false;
    if (file_exists($path)) {
        $found = true;
        $ok = true;
    }
    if ($found) {
        $icon1 = '<img src="' . SFADMINIMAGES . 'sp_Yes.png" title="' . spa_text('Location found') . '" alt="" style="vertical-align: middle;" />&nbsp;&nbsp;';
    } else {
        $icon1 = '<img src="' . SFADMINIMAGES . 'sp_No.png" title="' . spa_text('Location not found') . '" alt="" style="vertical-align: middle;" />&nbsp;&nbsp;';
        $icon2 = '<img src="' . SFADMINIMAGES . 'sp_NoWrite.png" title="' . spa_text('Write - denied') . '" alt="" style="vertical-align: middle;" />&nbsp;&nbsp;';
    }
    if ($found) {
        if (is_writable($path)) {
            $icon2 = '<img src="' . SFADMINIMAGES . 'sp_YesWrite.png" title="' . spa_text('Write - OK') . '" alt="" style="vertical-align: middle;" />&nbsp;&nbsp;';
        } else {
            $icon2 = '<img src="' . SFADMINIMAGES . 'sp_NoWrite.png" title="' . spa_text('Write - denied') . '" alt="" style="vertical-align: middle;" />&nbsp;&nbsp;';
            $ok = false;
        }
    }
    if ($na) {
        $icon2 = '<img src="' . SFADMINIMAGES . 'sp_NA.gif" title="" alt="" style="vertical-align: middle;" />&nbsp;&nbsp;';
        $ok = $found;
    }
    echo "<tr>\n";
    if ($found) {
        $tdClass = 'wp-core-ui spWFBorder';
    } else {
        $tdClass = 'wp-core-ui badLocation spWFBorder';
    }
    echo "<td class='{$tdClass}' style='width:9%'>\n";
    echo "<span class='sfalignleft'>{$icon1}<br />{$icon2}</span></td>";
    echo "<td class='{$tdClass}'><strong>{$label}</strong>";
    echo '<div class="clearboth"></div>';
    echo SF_STORE_RELATIVE_BASE;
    echo '<input type="text" style="width:50%" class="wp-core-ui " tabindex="' . $tab . '" name="' . $name . '" value="' . esc_attr($value) . '" ';
    echo "/></td>\n";
    if ($spDevice == 'desktop') {
        echo '<td class="' . $tdClass . '"><img src="' . SFADMINIMAGES . 'sp_Information.png" alt="" class="" title="' . $tooltips[sp_create_slug($name, false)] . '" /></td>';
    }
    echo "</tr>\n";
    $tab++;
    return $ok;
}
开发者ID:ashanrupasinghe,项目名称:govforuminstalledlocal,代码行数:47,代码来源:spa-integration-storage-form.php

示例12: spdb_select

if ($build < $section) {
    $users = spdb_select('set', 'SELECT user_id, admin_options FROM ' . SFMEMBERS . ' WHERE admin=1 OR moderator=1');
    if ($users) {
        foreach ($users as $user) {
            $options = unserialize($user->admin_options);
            unset($options['colors']);
            sp_update_member_item($user->user_id, 'admin_options', $options);
        }
    }
    sp_response($section);
}
# Start of Upgrade Routines - 5.2 ============================================================
$section = 9175;
if ($build < $section) {
    # create new permission for adding links to posts
    $authslug = sp_create_slug(spa_text('Creating'), false, SFAUTHCATS, '');
    $cat = spdb_table(SFAUTHCATS, "authcat_slug='{$authslug}'", 'authcat_id');
    sp_add_auth('create_links', spa_text('Can create links in posts'), 1, 0, 0, 0, $cat);
    # enable permission in roles based on current global flag
    $sffilters = sp_get_option('sffilters');
    if ($sffilters['sfallowlinks']) {
        $roles = spdb_table(SFROLES);
        if ($roles) {
            $auth_id = spdb_table(SFAUTHS, 'auth_name="create_links"', 'auth_id');
            foreach ($roles as $role) {
                $actions = unserialize($role->role_auths);
                $actions[$auth_id] = 1;
                spdb_query('UPDATE ' . SFROLES . " SET role_auths='" . serialize($actions) . "' WHERE role_id={$role->role_id}");
            }
            # reset all the auths
            sp_reset_auths();
开发者ID:brooklyntri,项目名称:btc-plugins,代码行数:31,代码来源:sp-upgrade.php


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