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

PHP is_nxt_error函数代码示例

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

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



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

示例1: _purge_content

 /**
  * Purge content
  *
  * @param string $path
  * @param int $type
  * @param string $error
  * @return boolean
  */
 function _purge_content($path, $type, &$error)
 {
     $url = sprintf(W3TC_CDN_EDGECAST_PURGE_URL, $this->_config['account']);
     $args = array('method' => 'PUT', 'user-agent' => W3TC_POWERED_BY, 'headers' => array('Accept' => 'application/json', 'Content-Type' => 'application/json', 'Authorization' => sprintf('TOK:%s', $this->_config['token'])), 'body' => json_encode(array('MediaPath' => $path, 'MediaType' => $type)));
     $response = nxt_remote_request($url, $args);
     if (is_nxt_error($response)) {
         $error = implode('; ', $response->get_error_messages());
         return false;
     }
     switch ($response['response']['code']) {
         case 200:
             return true;
         case 400:
             $error = 'Invalid Request Parameter';
             return false;
         case 403:
             $error = 'Authentication Failure or Insufficient Access Rights';
             return false;
         case 404:
             $error = 'Invalid Request URI';
             return false;
         case 405:
             $error = 'Invalid Request';
             return false;
         case 500:
             $error = 'Server Error';
             return false;
     }
     $error = 'Unknown error';
     return false;
 }
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:39,代码来源:Edgecast.php


示例2: __construct

 function __construct($url, $timeout = 10, $redirects = 5, $headers = null, $useragent = null, $force_fsockopen = false)
 {
     $this->url = $url;
     $this->timeout = $timeout;
     $this->redirects = $redirects;
     $this->headers = $headers;
     $this->useragent = $useragent;
     $this->method = SIMPLEPIE_FILE_SOURCE_REMOTE;
     if (preg_match('/^http(s)?:\\/\\//i', $url)) {
         $args = array('timeout' => $this->timeout, 'redirection' => $this->redirects);
         if (!empty($this->headers)) {
             $args['headers'] = $this->headers;
         }
         if (SIMPLEPIE_USERAGENT != $this->useragent) {
             //Use default nxt user agent unless custom has been specified
             $args['user-agent'] = $this->useragent;
         }
         $res = nxt_remote_request($url, $args);
         if (is_nxt_error($res)) {
             $this->error = 'nxt HTTP Error: ' . $res->get_error_message();
             $this->success = false;
         } else {
             $this->headers = nxt_remote_retrieve_headers($res);
             $this->body = nxt_remote_retrieve_body($res);
             $this->status_code = nxt_remote_retrieve_response_code($res);
         }
     } else {
         if (!($this->body = file_get_contents($url))) {
             $this->error = 'file_get_contents could not read the file';
             $this->success = false;
         }
     }
 }
开发者ID:nxtclass,项目名称:NXTClass,代码行数:33,代码来源:class-feed.php


示例3: register_importer

/**
 * Register importer for NXTClass.
 *
 * @since 2.0.0
 *
 * @param string $id Importer tag. Used to uniquely identify importer.
 * @param string $name Importer name and title.
 * @param string $description Importer description.
 * @param callback $callback Callback to run.
 * @return nxt_Error Returns nxt_Error when $callback is nxt_Error.
 */
function register_importer($id, $name, $description, $callback)
{
    global $nxt_importers;
    if (is_nxt_error($callback)) {
        return $callback;
    }
    $nxt_importers[$id] = array($name, $description, $callback);
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:19,代码来源:import.php


示例4: get_nxt_title_rss

/**
 * Retrieve the blog title for the feed title.
 *
 * @package NXTClass
 * @subpackage Feed
 * @since 2.2.0
 * @uses apply_filters() Calls 'get_nxt_title_rss' hook on title.
 * @uses nxt_title() See function for $sep parameter usage.
 *
 * @param string $sep Optional.How to separate the title. See nxt_title() for more info.
 * @return string Error message on failure or blog title on success.
 */
function get_nxt_title_rss($sep = '»')
{
    $title = nxt_title($sep, false);
    if (is_nxt_error($title)) {
        return $title->get_error_message();
    }
    $title = apply_filters('get_nxt_title_rss', $title);
    return $title;
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:21,代码来源:feed.php


示例5: add

 /**
  * Append to XML response based on given arguments.
  *
  * The arguments that can be passed in the $args parameter are below. It is
  * also possible to pass a nxt_Error object in either the 'id' or 'data'
  * argument. The parameter isn't actually optional, content should be given
  * in order to send the correct response.
  *
  * 'what' argument is a string that is the XMLRPC response type.
  * 'action' argument is a boolean or string that acts like a nonce.
  * 'id' argument can be nxt_Error or an integer.
  * 'old_id' argument is false by default or an integer of the previous ID.
  * 'position' argument is an integer or a string with -1 = top, 1 = bottom,
  * html ID = after, -html ID = before.
  * 'data' argument is a string with the content or message.
  * 'supplemental' argument is an array of strings that will be children of
  * the supplemental element.
  *
  * @since 2.1.0
  *
  * @param string|array $args Override defaults.
  * @return string XML response.
  */
 function add($args = '')
 {
     $defaults = array('what' => 'object', 'action' => false, 'id' => '0', 'old_id' => false, 'position' => 1, 'data' => '', 'supplemental' => array());
     $r = nxt_parse_args($args, $defaults);
     extract($r, EXTR_SKIP);
     $position = preg_replace('/[^a-z0-9:_-]/i', '', $position);
     if (is_nxt_error($id)) {
         $data = $id;
         $id = 0;
     }
     $response = '';
     if (is_nxt_error($data)) {
         foreach ((array) $data->get_error_codes() as $code) {
             $response .= "<nxt_error code='{$code}'><![CDATA[" . $data->get_error_message($code) . "]]></nxt_error>";
             if (!($error_data = $data->get_error_data($code))) {
                 continue;
             }
             $class = '';
             if (is_object($error_data)) {
                 $class = ' class="' . get_class($error_data) . '"';
                 $error_data = get_object_vars($error_data);
             }
             $response .= "<nxt_error_data code='{$code}'{$class}>";
             if (is_scalar($error_data)) {
                 $response .= "<![CDATA[{$error_data}]]>";
             } elseif (is_array($error_data)) {
                 foreach ($error_data as $k => $v) {
                     $response .= "<{$k}><![CDATA[{$v}]]></{$k}>";
                 }
             }
             $response .= "</nxt_error_data>";
         }
     } else {
         $response = "<response_data><![CDATA[{$data}]]></response_data>";
     }
     $s = '';
     if (is_array($supplemental)) {
         foreach ($supplemental as $k => $v) {
             $s .= "<{$k}><![CDATA[{$v}]]></{$k}>";
         }
         $s = "<supplemental>{$s}</supplemental>";
     }
     if (false === $action) {
         $action = $_POST['action'];
     }
     $x = '';
     $x .= "<response action='{$action}_{$id}'>";
     // The action attribute in the xml output is formatted like a nonce action
     $x .= "<{$what} id='{$id}' " . (false === $old_id ? '' : "old_id='{$old_id}' ") . "position='{$position}'>";
     $x .= $response;
     $x .= $s;
     $x .= "</{$what}>";
     $x .= "</response>";
     $this->responses[] = $x;
     return $x;
 }
开发者ID:nxtclass,项目名称:NXTClass,代码行数:79,代码来源:class-nxt-ajax-response.php


示例6: external_event

 /**
  * Makes external event request
  *
  * @param string $type
  * @param string $value
  * @return array
  */
 function external_event($type, $value)
 {
     require_once W3TC_INC_DIR . '/functions/http.php';
     $url = sprintf('%s?u=%s&tkn=%s&evnt_t=%s&evnt_v=%s', W3TC_CLOUDFLARE_EXTERNAL_EVENT_URL, urlencode($this->_config['email']), urlencode($this->_config['key']), urlencode($type), urlencode($value));
     $response = w3_http_get($url);
     if (!is_nxt_error($response)) {
         return json_decode($response['body']);
     }
     return false;
 }
开发者ID:nxtclass,项目名称:NXTClass,代码行数:17,代码来源:CloudFlare.php


示例7: w3_download

/**
 * Downloads URL into a file
 *
 * @param string $url
 * @param string $file
 * @return boolean
 */
function w3_download($url, $file)
{
    if (strpos($url, '//') === 0) {
        $url = (w3_is_https() ? 'https:' : 'http:') . $url;
    }
    $response = w3_http_get($url);
    if (!is_nxt_error($response) && $response['response']['code'] == 200) {
        return @file_put_contents($file, $response['body']);
    }
    return false;
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:18,代码来源:http.php


示例8: huddle_bp_show_blog_signup_form

function huddle_bp_show_blog_signup_form($blogname = '', $blog_title = '', $errors = '')
{
    global $current_user, $current_site;
    global $bp;
    if (isset($_POST['submit'])) {
        huddle_bp_blogs_validate_blog_signup();
    } else {
        if (!is_nxt_error($errors)) {
            $errors = new nxt_Error();
        }
        // allow definition of default variables
        $filtered_results = apply_filters('signup_another_blog_init', array('blogname' => $blogname, 'blog_title' => $blog_title, 'errors' => $errors));
        $blogname = $filtered_results['blogname'];
        $blog_title = $filtered_results['blog_title'];
        $errors = $filtered_results['errors'];
        if ($errors->get_error_code()) {
            echo "<p>" . __('There was a problem, please correct the form below and try again.', 'buddypress') . "</p>";
        }
        ?>
		<p><?php 
        printf(__("By filling out the form below, you can <strong>add a site to your account</strong>. There is no limit to the number of sites that you can have, so create to your heart's content, but blog responsibly!", 'buddypress'), $current_user->display_name);
        ?>
</p>

		<p><?php 
        _e("If you&#8217;re not going to use a great domain, leave it for a new user. Now have at it!", 'buddypress');
        ?>
</p>

		<form class="standard-form" id="setupform" method="post" action="">

			<input type="hidden" name="stage" value="gimmeanotherblog" />
			<?php 
        do_action('signup_hidden_fields');
        ?>

			<?php 
        huddle_bp_blogs_signup_blog($blogname, $blog_title, $errors);
        ?>
			
			<p class="editfield">
				<input id="submit" type="submit" name="submit" class="btn-gray submit" value="<?php 
        _e('Create Site', 'buddypress');
        ?>
" />
			</p>

			<?php 
        nxt_nonce_field('bp_blog_signup_form');
        ?>
		</form>
		<?php 
    }
}
开发者ID:nxtclass,项目名称:NXTClass-themes,代码行数:54,代码来源:functions.php


示例9: _request

 /**
  * Make API request
  *
  * @param string $url
  * @return string
  */
 function _request($url)
 {
     require_once W3TC_INC_DIR . '/functions/http.php';
     require_once W3TC_INC_DIR . '/functions/url.php';
     $request_url = w3_url_format(W3TC_PAGESPEED_API_URL, array('url' => $url, 'key' => $this->key));
     $response = w3_http_get($request_url);
     if (!is_nxt_error($response) && $response['response']['code'] == 200) {
         return $response['body'];
     }
     return false;
 }
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:17,代码来源:PageSpeed.php


示例10: bb_update_meta

/**
 * Adds and updates meta data in the database
 *
 * @internal
 */
function bb_update_meta($object_id = 0, $meta_key, $meta_value, $type, $global = false)
{
    global $bbdb;
    if (!is_numeric($object_id) || empty($object_id) && !$global) {
        return false;
    }
    $cache_object_id = $object_id = (int) $object_id;
    switch ($type) {
        case 'option':
            $object_type = 'bb_option';
            break;
        case 'user':
            global $nxt_users_object;
            $id = $object_id;
            $return = $nxt_users_object->update_meta(compact('id', 'meta_key', 'meta_value'));
            if (is_nxt_error($return)) {
                return false;
            }
            return $return;
            break;
        case 'forum':
            $object_type = 'bb_forum';
            break;
        case 'topic':
            $object_type = 'bb_topic';
            break;
        case 'post':
            $object_type = 'bb_post';
            break;
        default:
            $object_type = $type;
            break;
    }
    $meta_key = bb_sanitize_meta_key($meta_key);
    $meta_tuple = compact('object_type', 'object_id', 'meta_key', 'meta_value', 'type');
    $meta_tuple = apply_filters('bb_update_meta', $meta_tuple);
    extract($meta_tuple, EXTR_OVERWRITE);
    $meta_value = $_meta_value = maybe_serialize($meta_value);
    $meta_value = maybe_unserialize($meta_value);
    $cur = $bbdb->get_row($bbdb->prepare("SELECT * FROM `{$bbdb->meta}` WHERE `object_type` = %s AND `object_id` = %d AND `meta_key` = %s", $object_type, $object_id, $meta_key));
    if (!$cur) {
        $bbdb->query($bbdb->prepare("INSERT INTO `{$bbdb->meta}` ( `object_type`, `object_id`, `meta_key`, `meta_value` ) VALUES( %s, %d, %s, %s )\n\t\t\tON DUPLICATE KEY UPDATE `meta_value` = VALUES( `meta_value` )", $object_type, $object_id, $meta_key, $_meta_value));
    } elseif ($cur->meta_value != $meta_value) {
        $bbdb->update($bbdb->meta, array('meta_value' => $_meta_value), array('object_type' => $object_type, 'object_id' => $object_id, 'meta_key' => $meta_key));
    }
    if ($object_type === 'bb_option') {
        $cache_object_id = $meta_key;
        nxt_cache_delete($cache_object_id, 'bb_option_not_set');
    }
    nxt_cache_delete($cache_object_id, $object_type);
    if (!$cur) {
        return true;
    }
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:59,代码来源:functions.bb-meta.php


示例11: membership_is_active

function membership_is_active($userdata, $password)
{
    global $nxtdb;
    // Checks if this member is an active one.
    if (!empty($userdata) && !is_nxt_error($userdata)) {
        $id = $userdata->ID;
        if (get_usermeta($id, $nxtdb->prefix . 'membership_active', true) == 'no') {
            return new nxt_Error('member_inactive', __('Sorry, this account is not active.', 'membership'));
        }
    }
    return $userdata;
}
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:12,代码来源:functions.php


示例12: query

 function query()
 {
     $args = func_get_args();
     $method = array_shift($args);
     $request = new IXR_Request($method, $args);
     $xml = $request->getXml();
     $url = $this->scheme . '://' . $this->server . ':' . $this->port . $this->path;
     $args = array('headers' => array('Content-Type' => 'text/xml'), 'user-agent' => $this->useragent, 'body' => $xml);
     // Merge Custom headers ala #8145
     foreach ($this->headers as $header => $value) {
         $args['headers'][$header] = $value;
     }
     if ($this->timeout !== false) {
         $args['timeout'] = $this->timeout;
     }
     // Now send the request
     if ($this->debug) {
         echo '<pre class="ixr_request">' . htmlspecialchars($xml) . "\n</pre>\n\n";
     }
     $response = nxt_remote_post($url, $args);
     if (is_nxt_error($response)) {
         $errno = $response->get_error_code();
         $errorstr = $response->get_error_message();
         $this->error = new IXR_Error(-32300, "transport error: {$errno} {$errstr}");
         return false;
     }
     $code = $response['response']['code'];
     if ($code != 200) {
         $this->error = new IXR_Error(-32301, "transport error - HTTP status code was not 200 ({$code})");
         return false;
     }
     if ($this->debug) {
         echo '<pre class="ixr_response">' . htmlspecialchars($response['body']) . "\n</pre>\n\n";
     }
     // Now parse what we've got back
     $this->message = new IXR_Message($response['body']);
     if (!$this->message->parse()) {
         // XML error
         $this->error = new IXR_Error(-32700, 'parse error. not well formed');
         return false;
     }
     // Is the message a fault?
     if ($this->message->messageType == 'fault') {
         $this->error = new IXR_Error($this->message->faultCode, $this->message->faultString);
         return false;
     }
     // Message must be OK
     return true;
 }
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:49,代码来源:class.nxt-http-ixr-client.php


示例13: get_bookmark_field

/**
 * Retrieve single bookmark data item or field.
 *
 * @since 2.3.0
 * @uses get_bookmark() Gets bookmark object using $bookmark as ID
 * @uses sanitize_bookmark_field() Sanitizes Bookmark field based on $context.
 *
 * @param string $field The name of the data field to return
 * @param int $bookmark The bookmark ID to get field
 * @param string $context Optional. The context of how the field will be used.
 * @return string
 */
function get_bookmark_field($field, $bookmark, $context = 'display')
{
    $bookmark = (int) $bookmark;
    $bookmark = get_bookmark($bookmark);
    if (is_nxt_error($bookmark)) {
        return $bookmark;
    }
    if (!is_object($bookmark)) {
        return '';
    }
    if (!isset($bookmark->{$field})) {
        return '';
    }
    return sanitize_bookmark_field($field, $bookmark->{$field}, $bookmark->link_id, $context);
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:27,代码来源:bookmark.php


示例14: nxt_credits

function nxt_credits()
{
    global $nxt_version;
    $locale = get_locale();
    $results = get_site_transient('nxtclass_credits_' . $locale);
    if (!is_array($results)) {
        $response = nxt_remote_get("http://api.nxtclass.org/core/credits/1.0/?version={$nxt_version}&locale={$locale}");
        if (is_nxt_error($response) || 200 != nxt_remote_retrieve_response_code($response)) {
            return false;
        }
        $results = maybe_unserialize(nxt_remote_retrieve_body($response));
        if (!is_array($results)) {
            return false;
        }
        set_site_transient('nxtclass_credits_' . $locale, $results, 86400);
        // One day
    }
    return $results;
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:19,代码来源:credits.php


示例15: set_prefix

 /**
  * Sets the prefix of the database tables
  * @param string prefix
  * @param false|array tables (optional: false)
  *	table identifiers are array keys
  *	array values
  *		empty: set prefix: array( 'posts' => false, 'users' => false, ... )
  *		string: set to that array value: array( 'posts' => 'my_posts', 'users' => 'my_users' )
  *		array: array[0] is DB identifier, array[1] is table name: array( 'posts' => array( 'global', 'my_posts' ), 'users' => array( 'users', 'my_users' ) )
  *	OR array values (with numeric keys): array( 'posts', 'users', ... )
  *
  * @return string the previous prefix (mostly only meaningful if all $table parameter was false)
  */
 function set_prefix($prefix, $tables = false)
 {
     $old_prefix = parent::set_prefix($prefix, $tables);
     if (!$old_prefix || is_nxt_error($old_prefix)) {
         return $old_prefix;
     }
     if ($tables && is_array($tables)) {
         $_tables = $tables;
     } else {
         $_tables = $this->tables;
     }
     foreach ($_tables as $key => $value) {
         // array( 'posts' => array( 'global', 'my_posts' ), 'users' => array( 'users', 'my_users' ) )
         if (is_array($value) && isset($this->db_servers['dbh_' . $value[0]])) {
             $this->add_db_table($value[0], $value[1]);
             $this->{$key} = $value[1];
         }
     }
     return $old_prefix;
 }
开发者ID:nxtclass,项目名称:NXTClass,代码行数:33,代码来源:class.bpdb-multi.php


示例16: parse

 function parse($file)
 {
     // Attempt to use proper XML parsers first
     if (extension_loaded('simplexml')) {
         $parser = new WXR_Parser_SimpleXML();
         $result = $parser->parse($file);
         // If SimpleXML succeeds or this is an invalid WXR file then return the results
         if (!is_nxt_error($result) || 'SimpleXML_parse_error' != $result->get_error_code()) {
             return $result;
         }
     } else {
         if (extension_loaded('xml')) {
             $parser = new WXR_Parser_XML();
             $result = $parser->parse($file);
             // If XMLParser succeeds or this is an invalid WXR file then return the results
             if (!is_nxt_error($result) || 'XML_parse_error' != $result->get_error_code()) {
                 return $result;
             }
         }
     }
     // We have a malformed XML file, so display the error and fallthrough to regex
     if (isset($result) && defined('IMPORT_DEBUG') && IMPORT_DEBUG) {
         echo '<pre>';
         if ('SimpleXML_parse_error' == $result->get_error_code()) {
             foreach ($result->get_error_data() as $error) {
                 echo $error->line . ':' . $error->column . ' ' . esc_html($error->message) . "\n";
             }
         } else {
             if ('XML_parse_error' == $result->get_error_code()) {
                 $error = $result->get_error_data();
                 echo $error[0] . ':' . $error[1] . ' ' . esc_html($error[2]);
             }
         }
         echo '</pre>';
         echo '<p><strong>' . __('There was an error when reading this WXR file', 'nxtclass-importer') . '</strong><br />';
         echo __('Details are shown above. The importer will now try again with a different parser...', 'nxtclass-importer') . '</p>';
     }
     // use regular expressions if nothing else available or this is bad XML
     $parser = new WXR_Parser_Regex();
     return $parser->parse($file);
 }
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:41,代码来源:parsers.php


示例17: purge

 /**
  * Purge URI
  *
  * @param string $uri
  * @return boolean
  */
 function purge($uri)
 {
     require_once W3TC_INC_DIR . '/functions/http.php';
     @set_time_limit($this->_timeout);
     if (strpos($uri, '/') !== 0) {
         $uri = '/' . $uri;
     }
     foreach ((array) $this->_servers as $server) {
         $url = sprintf('http://%s%s', $server, $uri);
         $response = w3_http_request($url, array('method' => 'PURGE'));
         if (is_nxt_error($response)) {
             $this->_log($url, sprintf('Unable to send request: %s.', implode('; ', $response->get_error_messages())));
             return false;
         }
         if ($response['response']['code'] !== 200) {
             $this->_log($url, 'Bad response code.');
             return false;
         }
         $this->_log($url, 'OK');
     }
     return true;
 }
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:28,代码来源:Varnish.php


示例18: bb_activate_plugin

/**
 * Attempts activation of plugin in a "sandbox" and redirects on success.
 *
 * A plugin that is already activated will not attempt to be activated again.
 *
 * The way it works is by setting the redirection to the error before trying to
 * include the plugin file. If the plugin fails, then the redirection will not
 * be overwritten with the success message. Also, the options will not be
 * updated and the activation hook will not be called on plugin error.
 *
 * It should be noted that in no way the below code will actually prevent errors
 * within the file. The code should not be used elsewhere to replicate the
 * "sandbox", which uses redirection to work.
 *
 * If any errors are found or text is outputted, then it will be captured to
 * ensure that the success redirection will update the error redirection.
 *
 * @since 1.0
 *
 * @param string $plugin Plugin path to main plugin file with plugin data.
 * @param string $redirect Optional. URL to redirect to.
 * @return nxt_Error|null nxt_Error on invalid file or null on success.
 */
function bb_activate_plugin($plugin, $redirect = '')
{
    $active_plugins = (array) bb_get_option('active_plugins');
    $plugin = bb_plugin_basename(trim($plugin));
    $valid_path = bb_validate_plugin($plugin);
    if (is_nxt_error($valid_path)) {
        return $valid_path;
    }
    if (in_array($plugin, $active_plugins)) {
        return false;
    }
    if (!empty($redirect)) {
        // We'll override this later if the plugin can be included without fatal error
        nxt_redirect(add_query_arg('_scrape_nonce', bb_create_nonce('scrape-plugin_' . $plugin), $redirect));
    }
    ob_start();
    @(include $valid_path);
    // Add to the active plugins array
    $active_plugins[] = $plugin;
    ksort($active_plugins);
    bb_update_option('active_plugins', $active_plugins);
    do_action('bb_activate_plugin_' . $plugin);
    ob_end_clean();
    return $valid_path;
}
开发者ID:nxtclass,项目名称:NXTClass,代码行数:48,代码来源:functions.bb-plugin.php


示例19: delete_meta

 function delete_meta($args = null)
 {
     $defaults = array('id' => 0, 'meta_key' => null, 'meta_value' => null, 'meta_table' => 'usermeta', 'meta_field' => 'user_id', 'meta_id_field' => 'umeta_id', 'cache_group' => 'users');
     $args = nxt_parse_args($args, $defaults);
     extract($args, EXTR_SKIP);
     $user = $this->get_user($id);
     if (!$user || is_nxt_error($user)) {
         return $user;
     }
     $id = (int) $id;
     if (is_null($meta_key)) {
         return false;
     }
     $meta_key = preg_replace('|[^a-z0-9_]|i', '', $meta_key);
     $meta_tuple = compact('id', 'meta_key', 'meta_value', 'meta_table');
     $meta_tuple = apply_filters(__CLASS__ . '::' . __FUNCTION__, $meta_tuple);
     extract($meta_tuple, EXTR_OVERWRITE);
     $_meta_value = is_null($meta_value) ? null : maybe_serialize($meta_value);
     if (is_null($_meta_value)) {
         $meta_id = $this->db->get_var($this->db->prepare("SELECT {$meta_id_field} FROM {$this->db->{$meta_table}} WHERE {$meta_field} = %d AND meta_key = %s", $id, $meta_key));
     } else {
         $meta_id = $this->db->get_var($this->db->prepare("SELECT {$meta_id_field} FROM {$this->db->{$meta_table}} WHERE {$meta_field} = %d AND meta_key = %s AND meta_value = %s", $id, $meta_key, $_meta_value));
     }
     if (!$meta_id) {
         return false;
     }
     if (is_null($_meta_value)) {
         $this->db->query($this->db->prepare("DELETE FROM {$this->db->{$meta_table}} WHERE {$meta_field} = %d AND meta_key = %s", $id, $meta_key));
     } else {
         $this->db->query($this->db->prepare("DELETE FROM {$this->db->{$meta_table}} WHERE {$meta_id_field} = %d", $meta_id));
     }
     nxt_cache_delete($id, $cache_group);
     return true;
 }
开发者ID:nxtclass,项目名称:NXTClass-Plugin,代码行数:34,代码来源:class.nxt-users.php


示例20: get_inbox_count

 function get_inbox_count($user_id = 0)
 {
     global $nxtdb, $bp;
     if (empty($user_id)) {
         $user_id = $bp->loggedin_user->id;
     }
     $sql = $nxtdb->prepare("SELECT SUM(unread_count) FROM {$bp->messages->table_name_recipients} WHERE user_id = %d AND is_deleted = 0 AND sender_only = 0", $user_id);
     $unread_count = $nxtdb->get_var($sql);
     if (empty($unread_count) || is_nxt_error($unread_count)) {
         return 0;
     }
     return (int) $unread_count;
 }
开发者ID:nxtclass,项目名称:NXTClass,代码行数:13,代码来源:bp-messages-classes.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP is_object函数代码示例发布时间:2022-05-15
下一篇:
PHP is_numericint函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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