_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q238700 | ControllerResolver.getController | train | public function getController(Request $request, array $matched)
{
if (null !== $request->attributes->get('_controller')) {
return $this->createController($request->attributes->get('_controller'));
}
if ( ! $controller = $matched['_controller']) {
throw new \InvalidAr... | php | {
"resource": ""
} |
q238701 | ControllerResolver.createController | train | protected function createController($controller)
{
if (false === strpos($controller, '::')) {
throw new \InvalidArgumentException(sprintf('Unable to find controller "%s".', $controller));
}
list($class, $method) = explode('::', $controller, 2);
if ($this->container->has... | php | {
"resource": ""
} |
q238702 | ControllerResolver.getArguments | train | public function getArguments(Request $request, array $controller, array $matched)
{
$reflection = new \ReflectionMethod($controller[0], $controller[1]);
$attributes = $request->attributes->all();
$arguments = [];
foreach ($reflection->getParameters() as $param) {
if (ar... | php | {
"resource": ""
} |
q238703 | Type.get | train | public static function get( $post ) {
$post = is_a( $post, 'WP_Post' ) ? $post : get_post( $post );
$type = $post->post_type;
if ( 'page' === $type ) {
$template_slug = get_page_template_slug( $post->ID );
if ( ! empty( $template_slug ) ) {
$type .= '-' . wp_basename( $template_slug, '.php' );
}
}
... | php | {
"resource": ""
} |
q238704 | AuthController.postRegister | train | public function postRegister(RegisterRequest $request)
{
$inputs = $request->except('_token');
$inputs['password'] = Hash::make($inputs['password']);
$user = $this->userRepo->create($inputs);
Event::fire(new UserHasCreated($user));
return Redirect::to('/');
} | php | {
"resource": ""
} |
q238705 | AuthController.postLogin | train | public function postLogin(LoginRequest $request)
{
$inputs = $request->except('_token','rememberme');
$rememberme = $request->get('rememberme');
$attemp = Auth::attempt($inputs, !!$rememberme);
if (!$attemp) {
$request->session()->flash('error', trans('auth.failed'));
... | php | {
"resource": ""
} |
q238706 | TemplatesManager.loadTemplates | train | protected function loadTemplates()
{
$templates = $this->templatesObjectBackend->loadObject();
if (!is_array($templates)) {
$templates = array();
}
$this->templates = $templates;
} | php | {
"resource": ""
} |
q238707 | TemplatesManager.addTemplate | train | public function addTemplate($key, $file, $priority = 10)
{
// If the file does not exists we can't add the file
// to the templates...
if (!file_exists($file) || !is_readable($file)) {
return false;
}
// Create the arrays, if they are not existing
... | php | {
"resource": ""
} |
q238708 | TemplatesManager.removeTemplate | train | public function removeTemplate($key, $file, $priority = 10)
{
// If we can't find the template file we do not have to remove anything.
if (!isset($this->templates[$key][$priority])) {
return false;
}
// Remove the template file.
unset($this->templates[$ke... | php | {
"resource": ""
} |
q238709 | TemplatesManager.addRenderer | train | public function addRenderer(RendererAbstract $renderer)
{
$extension = $renderer->getExtension();
if (isset($this->renderer[$extension])) {
return false;
}
$this->renderer[$extension] = $renderer;
return true;
} | php | {
"resource": ""
} |
q238710 | TemplatesManager.renderTemplate | train | public function renderTemplate($key, $additionalData = array())
{
if (!isset($this->templates[$key])) {
return '';
}
$output = '';
// Render the template files
foreach ($this->templates[$key] as $priority => $templateFile) {
$output .... | php | {
"resource": ""
} |
q238711 | TemplatesManager.searchRendererAndRenderTemplate | train | protected function searchRendererAndRenderTemplate($templateFile, $additionalData = array())
{
// Get the file information for the template file
$fileInfo = pathinfo($templateFile);
$extension = $fileInfo['extension'];
// If we haven't a renderer for this extension we return... | php | {
"resource": ""
} |
q238712 | Autoloader.load | train | public static function load($name){
if(substr($name, 0, 7)!='csslib\\') return false;
$filename = __DIR__.'/src/'.implode('/', array_slice(explode('\\', $name), 1)).'.php';
if(!file_exists($filename)) throw new \Exception('File "'.$filename.'" not found');
require_once $filename;
if(class_exists(... | php | {
"resource": ""
} |
q238713 | Model.load | train | public static function load($model = false) {
$path = DOC_ROOT . Config::get('paths', 'modules');
if ($model && File::isFile($path . $model . '.php')) {
$array = explode('/', $model);
$modelName = end($array);
require $path . $model . '.php';
... | php | {
"resource": ""
} |
q238714 | ImageTemplatingHelper.getImagePath | train | private function getImagePath($path)
{
if ($path && file_exists($this->filesystem->getRootDir() . $path)) {
return $path;
}
return $this->noImagePath;
} | php | {
"resource": ""
} |
q238715 | Registry.set | train | public function set($key, $object) {
if (! is_object($object)) {
throw new \InvalidArgumentException("Registry only accepts objects, given: ".gettype($object));
}
$this->_data[$key] = $object;
return $this;
} | php | {
"resource": ""
} |
q238716 | Registry.add | train | public function add(array $items) {
foreach($items as $name => $object) {
$this->set($name, $object);
}
return $this;
} | php | {
"resource": ""
} |
q238717 | Registry.get | train | public function get($key) {
if (isset($this->_data[$key])) {
return $this->_data[$key];
}
if (isset($this->registered[$key])) {
return $this->_data[$key] = call_user_func($this->registered[$key], $this);
}
return null;
} | php | {
"resource": ""
} |
q238718 | Registry.exists | train | public function exists($key) {
return isset($this->_data[$key]) || isset($this->registered[$key]);
} | php | {
"resource": ""
} |
q238719 | ApiBaseController.paginate | train | protected function paginate(Request $request)
{
$fields = $request->input('fields') ? explode(',', $request->input('fields')) : ['*'];
$pageSize = $request->input('pageSize') ? (int)$request->input('pageSize') : null;
$sort = $request->input('sort') ? $request->input('sort') : null;
... | php | {
"resource": ""
} |
q238720 | ApiBaseController.update | train | public function update(Request $request, $id)
{
$response = $this->repository->update($id, $request->all());
return Response::apiResponse([
'data' => $response
]);
} | php | {
"resource": ""
} |
q238721 | BlendCommand.getBundlesToBlend | train | private function getBundlesToBlend()
{
$toBlend = array();
foreach ($this->config['blend'] as $key => $params) {
$vendor = isset($params['vendor']) ? $params['vendor'] : null;
$name = isset($params['name']) ? $params['name'] : null;
$path = isset($params['path'])... | php | {
"resource": ""
} |
q238722 | BlendCommand.blend | train | private function blend($toBlend, OutputInterface $output)
{
$fs = new Filesystem();
$vendorDir = $this->getContainer()->getParameter('kernel.root_dir') . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'vendor';
foreach ($toBlend as $vendor => $names) {
foreach ($nam... | php | {
"resource": ""
} |
q238723 | Zend_Gdata_Spreadsheets_ListQuery.setSpreadsheetQuery | train | public function setSpreadsheetQuery($value)
{
if ($value != null) {
$this->_params['sq'] = $value;
} else {
unset($this->_params['sq']);
}
return $this;
} | php | {
"resource": ""
} |
q238724 | Zend_Gdata_Spreadsheets_ListQuery.setReverse | train | public function setReverse($value)
{
if ($value != null) {
$this->_params['reverse'] = $value;
} else {
unset($this->_params['reverse']);
}
return $this;
} | php | {
"resource": ""
} |
q238725 | Thumb.size | train | public function size(Int $width, Int $height) : Thumb
{
$this->sets['width'] = $width;
$this->sets['height'] = $height;
return $this;
} | php | {
"resource": ""
} |
q238726 | Thumb.resize | train | public function resize(Int $width, Int $height) : Thumb
{
$this->sets['rewidth'] = $width;
$this->sets['reheight'] = $height;
return $this;
} | php | {
"resource": ""
} |
q238727 | Thumb.prosize | train | public function prosize(Int $width, Int $height = 0) : Thumb
{
$this->sets['prowidth'] = $width;
$this->sets['proheight'] = $height;
return $this;
} | php | {
"resource": ""
} |
q238728 | Thumb.create | train | public function create(String $path = NULL) : String
{
if( isset($this->sets['filePath']) )
{
$path = $this->sets['filePath'];
}
# It keeps the used filters belonging to the GD class.
# [5.7.8]added
$this->sets['filters'] = $this->filters;
$setti... | php | {
"resource": ""
} |
q238729 | Thumb.getProsize | train | public function getProsize(Int $width = 0, Int $height = 0)
{
if( ! isset($this->sets['filePath']) )
{
return false;
}
return $this->image->getProsize($this->sets['filePath'], $width, $height);
} | php | {
"resource": ""
} |
q238730 | Log.getPathToLogFile | train | public function getPathToLogFile($name = 'm62')
{
if (is_null($this->log_path)) {
$this->log_path = realpath(dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'logs') . DIRECTORY_SEPARATOR . $name . '.log';
}
return $this->log_path;
} | php | {
"resource": ""
} |
q238731 | Log.removeLogFile | train | public function removeLogFile()
{
if (file_exists($this->log_path)) {
$this->logger = null;
unlink($this->log_path);
}
return $this;
} | php | {
"resource": ""
} |
q238732 | Emitter.ensureListener | train | protected function ensureListener($listener)
{
if ($listener instanceof ListenerInterface) {
return $listener;
}
if (is_callable($listener)) {
return CallbackListener::fromCallable($listener);
}
throw new InvalidArgumentException('Listeners should be... | php | {
"resource": ""
} |
q238733 | SessionController.touchAction | train | public function touchAction($sessionId) {
if ($this->request->getHttpRequest()->getMethod() !== 'POST') {
$this->response->setStatus(405);
$this->response->setHeader('Allow', 'POST');
return;
}
$session = $this->sessionManager->getSession($sessionId);
if ($session !== NULL) {
$session->touch();
... | php | {
"resource": ""
} |
q238734 | RepositoryFactory.getRepositoryForEntity | train | public function getRepositoryForEntity(string $entityName, string $connectionName = null): AbstractRepository
{
/** @var AbstractRepository $repository */
$repository = $this->loadFactorableInstance($entityName);
if (is_string($connectionName)) {
$entityManager = $this->getConta... | php | {
"resource": ""
} |
q238735 | SsoClientFactory.create | train | public function create() {
$ssoClient = new \Flowpack\SingleSignOn\Client\Domain\Model\SsoClient();
if ((string)$this->clientServiceBaseUri === '') {
throw new Exception('Missing Flowpack.SingleSignOn.Client.client.serviceBaseUri setting', 1351075078);
}
$ssoClient->setServiceBaseUri($this->clientServiceBase... | php | {
"resource": ""
} |
q238736 | StringObject.delimitString | train | private static function delimitString(string $string, string $delimiter): string
{
$output = [];
if (preg_match('/\A[a-z0-9]+\z/ui', $string) && strtoupper($string) !== $string) {
$parts = self::explodeOnCaps($string);
} else {
$parts = self::explodeOnDelims($string)... | php | {
"resource": ""
} |
q238737 | StringObject.explodeOnCaps | train | private static function explodeOnCaps(string $string): array
{
$string = preg_replace('/\B([A-Z])/', '_\1', $string);
$string = preg_replace('/([0-9]+)/', '_\1', $string);
$string = preg_replace('/_+/', '_', $string);
$string = trim($string, '_');
return explode('_', $string... | php | {
"resource": ""
} |
q238738 | StringObject.explodeOnDelims | train | private static function explodeOnDelims(string $string): array
{
$string = preg_replace('/[^a-z0-9]+/i', '_', $string);
$string = trim($string, '_');
return explode('_', $string);
} | php | {
"resource": ""
} |
q238739 | ModuleBag.get | train | public function get($key = null)
{
if ($key === null) {
return $this;
}
if (!isset($this->modules[$key])) {
throw new ModuleDoesntExistException($key);
}
return $this->modules[$key];
} | php | {
"resource": ""
} |
q238740 | Linkable.insertMenuObject | train | private function insertMenuObject($slug, $callback, $object)
{
$object->slug = $this->snakeName($slug);
$object->menu = $this->getMenu();
call_user_func($callback, $object);
if (! $object->insert) {
$this->links[] = $object;
}
} | php | {
"resource": ""
} |
q238741 | AbstractRepository.configureMetadata | train | protected function configureMetadata()
{
$this->entityMetadata->setCollection($this->collectionName);
if (!empty($this->primaryKey)) {
$this->entityMetadata->setPrimaryKey($this->primaryKey);
}
} | php | {
"resource": ""
} |
q238742 | FileList.sort | train | protected function sort($items, $type = self::TYPE_BOTH, $by = self::KEY_NAME, $direction = self::ASC)
{
$returnArray = array();
if (count($items) > 0) {
$tmpArray = array();
foreach($items as $key => $value) {
$tmpArray[$key] = $value[$by];
}
... | php | {
"resource": ""
} |
q238743 | FileList.get | train | public function get($directory, $type = self::TYPE_BOTH, $order = self::KEY_NAME, $direction = self::ASC, $limit = null, $fileExtensions = array()) {
// Get the contents of the dir
$items = array();
$directory = rtrim($directory,'/');
// Check Dir
if (!is_dir($directory)) {
... | php | {
"resource": ""
} |
q238744 | FileList.getExtension | train | protected function getExtension($file)
{
if (strpos($file, '.') !== false) {
$tempExt = strtolower(substr($file, strrpos($file, '.') + 1, strlen($file) - strrpos($file, '.')));
return strtolower(trim($tempExt,'/'));
}
return '';
} | php | {
"resource": ""
} |
q238745 | SriController.actionTaskstatusindex | train | public function actionTaskstatusindex()
{
$searchModel = new SRITaskstatusSearch();
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
return $this->render('taskstatus_index', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
... | php | {
"resource": ""
} |
q238746 | SriController.actionTaskstatuscreate | train | public function actionTaskstatuscreate()
{
$model = new SRI_Taskstatus();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['taskstatusview', 'id' => $model->id]);
} else {
return $this->render('taskstatus_create', [
... | php | {
"resource": ""
} |
q238747 | SriController.actionTaskstatusupdate | train | public function actionTaskstatusupdate($id)
{
$model = $this->findTaskstatusmodel($id);
if ($model->load(Yii::$app->request->post()) && $model->save()) {
return $this->redirect(['taskstatusview', 'id' => $model->id]);
} else {
return $this->render('taskstatus_update'... | php | {
"resource": ""
} |
q238748 | UploadTarget.set | train | public function set($target)
{
if (! is_string($target) || empty($target)) {
throw new InvalidArgumentException(
'Invalid target provided. Must be an non-empty string.'
);
}
$this->target = $target;
} | php | {
"resource": ""
} |
q238749 | Expr.references | train | public function references($document)
{
if ($this->currentField) {
$mapping = $this->class->getFieldMapping($this->currentField);
$dbRef = $this->dm->createDBRef($document, $mapping);
if (isset($mapping['simple']) && $mapping['simple']) {
$this->query[$ma... | php | {
"resource": ""
} |
q238750 | ObjectUtil.apply | train | public static function apply($object, array $values)
{
foreach ($values as $property => $value) {
// Check if the value is a map (associative array) by checking for
// a zero index.
if (is_array($value) and ! isset($value[0])) {
$method = "get".ucfirst($pr... | php | {
"resource": ""
} |
q238751 | ObjectUtil.validate | train | public static function validate($object, array $values, array $constraints)
{
$errors = array();
// Build a validator and get the entity constraints from the
// entity object.
$validatorBuilder = new ValidatorBuilder();
$validator = $validatorBuilder->getValidator();
... | php | {
"resource": ""
} |
q238752 | MbResponse.redirect | train | public function redirect($url, array $params = [], $status = 302)
{
if (!empty($params)) {
$url = rtrim(preg_replace('/\?.*/', '', $url), '/');
$url .= "?" . http_build_query($params);
}
$this->statusCode = $status;
$this->headers->set('Location', $url);
... | php | {
"resource": ""
} |
q238753 | MbResponse.ajaxContent | train | protected function ajaxContent($content)
{
$message = null;
$this->header('Content-Type', 'application/json');
if ($content instanceof Arrayable) {
$content = $content->toArray();
} elseif (is_string($content)) {
$content = ['content' => $content];
}... | php | {
"resource": ""
} |
q238754 | MbResponse.htmlContent | train | protected function htmlContent($content)
{
try {
$this->getMbAudit()->setResponseType('html');
if ($content instanceof \Exception) {
throw $content;
} elseif ($content instanceof \SplFileInfo && !$this->getMbRequest()->isBlogAdmin()) {
... | php | {
"resource": ""
} |
q238755 | MbResponse.adminNotice | train | public function adminNotice($message, $type = 'success')
{
MbWPActionHook::addActionCallback('admin_notices', function () use ($message, $type) {
echo self::adminNoticeTemplate($message, $type);
});
} | php | {
"resource": ""
} |
q238756 | Spot2ServiceProvider.register | train | public function register(Container $container)
{
$container['spot2.connections'] = [];
$container['spot2.connections.default'] = null;
$container['spot2.config'] = function (Container $container) {
$config = new Config();
foreach ($container['spot2.connections... | php | {
"resource": ""
} |
q238757 | LanguageController.actionEdit | train | public function actionEdit($id)
{
$model = $this->findModel($id);
$form = new LanguageForm($model);
if (Yii::$app->request->isAjax && $form->load(Yii::$app->request->post())){
if (!$errors = ActiveForm::validate($form)) {
try {
$this->service-... | php | {
"resource": ""
} |
q238758 | Zend_Gdata_AuthSub.getAuthSubTokenUri | train | public static function getAuthSubTokenUri($next, $scope, $secure=0, $session=0,
$request_uri = self::AUTHSUB_REQUEST_URI)
{
$querystring = '?next=' . urlencode($next)
. '&scope=' . urldecode($scope)
. '&secure=' . urlencode($secure)
... | php | {
"resource": ""
} |
q238759 | Zend_Gdata_AuthSub.getAuthSubSessionToken | train | public static function getAuthSubSessionToken(
$token, $client = null,
$request_uri = self::AUTHSUB_SESSION_TOKEN_URI)
{
$client = self::getHttpClient($token, $client);
if ($client instanceof Zend_Gdata_HttpClient) {
$filterResult = $client->filterHttpRequest('GE... | php | {
"resource": ""
} |
q238760 | Zend_Gdata_AuthSub.AuthSubRevokeToken | train | public static function AuthSubRevokeToken($token, $client = null,
$request_uri = self::AUTHSUB_REVOKE_TOKEN_URI)
{
$client = self::getHttpClient($token, $client);
if ($client instanceof Zend_Gdata_HttpClient) {
$filterResult = $client->filte... | php | {
"resource": ""
} |
q238761 | Zend_Gdata_AuthSub.getAuthSubTokenInfo | train | public static function getAuthSubTokenInfo(
$token, $client = null, $request_uri = self::AUTHSUB_TOKEN_INFO_URI)
{
$client = self::getHttpClient($token, $client);
if ($client instanceof Zend_Gdata_HttpClient) {
$filterResult = $client->filterHttpRequest('GET', $request_uri);... | php | {
"resource": ""
} |
q238762 | Zend_Gdata_AuthSub.getHttpClient | train | public static function getHttpClient($token, $client = null)
{
if ($client == null) {
$client = new Zend_Gdata_HttpClient();
}
if (!$client instanceof Zend_Gdata_HttpClient) {
require_once 'Zend/Gdata/App/HttpException.php';
throw new Zend_Gdata_App_HttpEx... | php | {
"resource": ""
} |
q238763 | DispatchesControllerListener.onDispatch | train | public function onDispatch(SystemEvent $event)
{
$server = $this->getServer();
$request = $server->getRequest();
$controllerName = $request->getAttribute('controller');
if (! $controllerName) {
throw new RuntimeException(
'Unable to dispatch the system e... | php | {
"resource": ""
} |
q238764 | DispatchesControllerListener.doDispatch | train | public function doDispatch(DispatchEvent $event)
{
$controller = $event->getContext();
$action = $event->getParam('action') . 'Action';
$server = $this->getServer();
$request = $server->getRequest()->withAddedAttributes($event->getParams());
$response = $server->getRe... | php | {
"resource": ""
} |
q238765 | CachedCallable.getTtlAndKey | train | protected function getTtlAndKey(array &$args)/*# : array */
{
if (is_numeric($args[0])) {
$ttl = (int) array_shift($args);
$key = $this->generateKey($args);
} else {
$key = $this->generateKey($args);
$ttl = $this->ttl;
}
return [$ttl, $... | php | {
"resource": ""
} |
q238766 | Event.create | train | public static function create( $eventName, $eventArgs = null ) {
if ( !is_string( $eventName ) ) {
throw new \browserfs\Exception('Invalid argument $eventName: string expected!');
}
if ( null !== $eventArgs && !is_array( $eventArgs ) ) {
throw new \browserfs\Exception('Invalid argument $eventAr... | php | {
"resource": ""
} |
q238767 | Adapter.select | train | public function select($table, $fields, $where = [], $options = [])
{
if (is_scalar($fields)) {
$fields = explode(',', $fields);
}
$query = new Select(
$this,
$table,
$fields,
new Where($where),
new Options($options)
... | php | {
"resource": ""
} |
q238768 | Adapter.fetch | train | public function fetch($table, $fields, $where = null, $options = [])
{
$options['limit'] = 1;
if (!isset($options['offset'])) {
$options['offset'] = 0;
}
$result = $this->select($table, $fields, $where, $options);
foreach ($result as $row) {
return $ro... | php | {
"resource": ""
} |
q238769 | Adapter.column | train | public function column($table, $field, $where = null, $options = null)
{
$results = $this->fetch($table, $field, $where, $options);
return array_shift($results);
} | php | {
"resource": ""
} |
q238770 | Adapter.fetchObject | train | public function fetchObject(
$class = null,
$table,
$fields,
$where = null,
$options = []
)
{
if (is_null($class)) {
$class = 'StdClass';
} elseif (is_object($class)) {
$class = get_class($class);
}
if (is_scalar($fi... | php | {
"resource": ""
} |
q238771 | Adapter.update | train | public function update($table, array $fields, $where, $options = null)
{
$query = new Update(
$this,
$table,
$fields,
new Where($where),
new Options($options)
);
return $query->execute();
} | php | {
"resource": ""
} |
q238772 | Adapter.delete | train | public function delete($table, array $where)
{
$query = new Delete($this, $table, new Where($where));
return $query->execute();
} | php | {
"resource": ""
} |
q238773 | ConfigProvider.getDependencies | train | protected function getDependencies()
{
return [
'factories' => [
PermissionMiddleware::class => PermissionMiddlewareFactory::class,
ExpressiveRouteName::class => InvokableFactory::class,
PermissionMiddleware::class => PermissionMiddlewareFactory::c... | php | {
"resource": ""
} |
q238774 | PropertyGenerator.getGeneratedProperties | train | protected function getGeneratedProperties(): array
{
$reflectionObject = new \ReflectionObject($this);
$properties = $reflectionObject->getProperties(\ReflectionProperty::IS_PUBLIC);
$result = [];
foreach ($properties as $property) {
if (!$property->isPublic() || @$proper... | php | {
"resource": ""
} |
q238775 | PropertyGenerator.removeGeneratedProperties | train | protected function removeGeneratedProperties()
{
$properties = $this->getGeneratedProperties();
foreach ($properties as $property) {
$name = $property->getName();
unset($this->{$name});
}
} | php | {
"resource": ""
} |
q238776 | View.namespace | train | public static function namespace($key, $path){
if(!array_key_exists($key, self::$namespaces))
self::$namespaces[$key] = $path;
} | php | {
"resource": ""
} |
q238777 | View.render | train | public function render($direct_output = true)
{
// controlla che il file esista
if($this->exists() == false)
return false;
// Carica il contenuto e imposta i parametri settati
// come variabili di contesto
extract($this->params);
ob_start();
inclu... | php | {
"resource": ""
} |
q238778 | View.make | train | public static function make($filename, $params = array(), $direct_output = true){
$view = new View($filename, $params);
return $view->render($direct_output);
} | php | {
"resource": ""
} |
q238779 | Html.attribs | train | public static function attribs($attribs, $leading_space = true)
{
if (!Arr::iterable($attribs)) {
return '';
}
$out = array();
foreach ($attribs as $k => $v) {
$v = (is_array($v)) ? join(' ', $v) : $v;
$out[] = $k . '="' . str_replace('"',... | php | {
"resource": ""
} |
q238780 | Html.image | train | public static function image($src, $alt = null, $attribs = array())
{
$attribs = array_merge(array('src'=>$src), $attribs);
if ($alt) {
$attribs['alt'] = htmlentities($alt);
}
return self::tag('img', null, $attribs);
} | php | {
"resource": ""
} |
q238781 | Html.listy | train | public static function listy($items, $attribs = array(), $type = 'ul')
{
if (!Arr::iterable($items)) {
return '';
}
$htmls = array();
$htmls[] = '<' . $type . self::attribs($attribs) . '>';
foreach ($items as $item) {
$htmls[] = '<li>' . $item... | php | {
"resource": ""
} |
q238782 | Html.alisty | train | public static function alisty($items, $attribs = array(), $type = 'ul', $active_title = null)
{
if (!Arr::iterable($items)) {
return '';
}
$htmls = array();
$htmls[] = '<' . $type . self::attribs($attribs) . '>';
foreach ($items as $title => $href) {
... | php | {
"resource": ""
} |
q238783 | Html.selecty | train | public static function selecty($options, $selected = null, $attribs = array())
{
$htmls = array();
$htmls[] = self::select(null, $attribs, false);
if (Arr::iterable($options)) {
foreach ($options as $value => $title) {
$option_attribs = array('value'=>$value);
... | php | {
"resource": ""
} |
q238784 | Html.tably | train | public static function tably($records)
{
if (count($records) === 0) {
return null;
}
$htmls = array();
$htmls[] = '<table>';
foreach ($records as $record) {
$htmls[] = '<tr>';
foreach ($record as $k => $v) {
$htmls[... | php | {
"resource": ""
} |
q238785 | AllInterfacesBase.getAllInterfaces | train | function getAllInterfaces($includeSelf) {
if (NULL === $this->interfacesAll) {
$this->interfacesAllInclSelf = $this->interfacesAll = $this->buildAllInterfacesWithoutSelf();
if (NULL !== $this->selfInterfaceName) {
$selfInterface = $this->classIndex->classGetReflection($this->selfInterfaceName);
... | php | {
"resource": ""
} |
q238786 | MenuEntry.hasVisibleChildren | train | public function hasVisibleChildren()
{
foreach ($this->children as $child) {
if (!($child instanceof \Zepi\Web\General\Entity\HiddenMenuEntry)) {
return true;
}
}
return false;
} | php | {
"resource": ""
} |
q238787 | MenuEntry.shouldHide | train | public function shouldHide()
{
if (!$this->hideWhenEmpty) {
return false;
}
foreach ($this->children as $child) {
if (!$child->shouldHide()) {
return false;
}
}
return true;
} | php | {
"resource": ""
} |
q238788 | MenuEntry.addChild | train | public function addChild(MenuEntry $child)
{
if (isset($this->children[$child->getKey()])) {
return false;
}
$this->children[$child->getKey()] = $child;
// Sets this MenuEntry as parent of the child
$child->setParent($this);
retu... | php | {
"resource": ""
} |
q238789 | MenuEntry.getBestTarget | train | public function getBestTarget()
{
if ($this->hasParent() && ($this->target == '' || $this->target == '#')) {
return $this->parent->getBestTarget();
}
return $this->target;
} | php | {
"resource": ""
} |
q238790 | MenuEntry.setActive | train | public function setActive($isActive)
{
$this->isActive = (bool) $isActive;
if ($this->parent !== null) {
$this->parent->setActive($isActive);
}
} | php | {
"resource": ""
} |
q238791 | SingleFieldCell.getFieldGetter | train | protected function getFieldGetter(\ReflectionClass $reflectionClass, $fieldName)
{
foreach (array('get', 'is', 'has') as $prefix) {
$getter = $prefix.ucfirst($fieldName);
$reflectionMethod = $reflectionClass->getMethod($getter);
if ($reflectionMethod && $reflectionMethod... | php | {
"resource": ""
} |
q238792 | Field.build | train | public function build($propOverride = array())
{
$this->debug->info(__METHOD__, $this->attribs['name']);
if ($propOverride == 'tagOnly') {
$propOverride = array('tagOnly' => true);
} elseif (!\is_array($propOverride)) {
$this->debug->warn('invalid propOverride', $prop... | php | {
"resource": ""
} |
q238793 | Field.doValidate | train | public function doValidate()
{
$isValid = true;
if ($this->props['validate']) {
$isValid = \call_user_func($this->props['validate'], $this);
}
return $isValid;
} | php | {
"resource": ""
} |
q238794 | Field.flag | train | public function flag($reason = null)
{
$this->props['isValid'] = false;
$this->classAdd($this->props['attribsContainer'], 'has-error');
if ($this->attribs['type'] == 'file' && isset($this->form->currentValues[ $this->attribs['name'] ])) {
$fileInfo = $this->form->currentValues[ $... | php | {
"resource": ""
} |
q238795 | Field.focus | train | public function focus()
{
if (\in_array($this->attribs['type'], array('checkbox', 'radio'))) {
$keys = \array_keys($this->props['options']);
$this->props['options'][ $keys[0] ]['autofocus'] = true;
} else {
$this->attribs['autofocus'] = true;
}
} | php | {
"resource": ""
} |
q238796 | Field.getId | train | public function getId()
{
$id = $this->props['attribs']['id'];
$sepChar = '_'; // character to join prefix and id
$repChar = '_'; // replace \W with this char
if (!$id && $this->props['attribs']['name']) {
$id = \preg_replace('/\W/', $repChar, $this->props['attribs']['nam... | php | {
"resource": ""
} |
q238797 | Field.getUniqueId | train | public function getUniqueId($increment = true)
{
$id = $this->getId();
if ($id) {
$sepChar = '_';
if (isset(self::$idCounts[$id])) {
if ($increment) {
self::$idCounts[$id] ++;
}
if (self::$idCounts[$id] > 1) ... | php | {
"resource": ""
} |
q238798 | Field.isRequired | train | public function isRequired()
{
$isRequired = $this->attribs['required'];
if (\is_string($isRequired)) {
$replaced = \preg_replace('/{{(.*?)}}/', '$this->form->getField("$1")->val()', $isRequired);
$evalString = '$isRequired = (bool) '.$replaced.';';
eval($evalStri... | php | {
"resource": ""
} |
q238799 | Field.setProps | train | public function setProps($props = array())
{
$props = $this->moveShortcuts($props);
$type = isset($props['attribs']['type']) ? $props['attribs']['type'] : null;
$typeChanging = $type && (!isset($this->attribs['type']) || $type !== $this->attribs['type']);
$propsType = $typeChanging &... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.