_id
stringlengths
2
7
title
stringlengths
3
151
partition
stringclasses
3 values
text
stringlengths
83
13k
language
stringclasses
1 value
meta_information
dict
q253700
CustomFieldsGroupController.indexAction
validation
public function indexAction() { $em = $this->getDoctrine()->getManager(); $cfGroups = $em->getRepository('ChillCustomFieldsBundle:CustomFieldsGroup')->findAll(); $defaultGroups = $this->getDefaultGroupsId(); $makeDefaultFormViews = array(); foreach ($cfGroups as $gr...
php
{ "resource": "" }
q253701
CustomFieldsGroupController.getDefaultGroupsId
validation
private function getDefaultGroupsId() { $em = $this->getDoctrine()->getManager(); $customFieldsGroupIds = $em->createQuery('SELECT g.id FROM ' . 'ChillCustomFieldsBundle:CustomFieldsDefaultGroup d ' . 'JOIN d.customFieldsGroup g') ->getResult(...
php
{ "resource": "" }
q253702
CustomFieldsGroupController.createMakeDefaultForm
validation
private function createMakeDefaultForm(CustomFieldsGroup $group = null) { return $this->createFormBuilder($group, array( 'method' => 'POST', 'action' => $this->generateUrl('customfieldsgroup_makedefault') )) ->add('id', 'hidden') ...
php
{ "resource": "" }
q253703
CustomFieldsGroupController.createCreateForm
validation
private function createCreateForm(CustomFieldsGroup $entity) { $form = $this->createForm('custom_fields_group', $entity, array( 'action' => $this->generateUrl('customfieldsgroup_create'), 'method' => 'POST', )); $form->add('submit', 'submit', array('label' => 'Create...
php
{ "resource": "" }
q253704
CustomFieldsGroupController.newAction
validation
public function newAction() { $entity = new CustomFieldsGroup(); $form = $this->createCreateForm($entity); return $this->render('ChillCustomFieldsBundle:CustomFieldsGroup:new.html.twig', array( 'entity' => $entity, 'form' => $form->createView(), )); }
php
{ "resource": "" }
q253705
CustomFieldsGroupController.showAction
validation
public function showAction($id) { $em = $this->getDoctrine()->getManager(); $entity = $em->getRepository('ChillCustomFieldsBundle:CustomFieldsGroup')->find($id); if (!$entity) { throw $this->createNotFoundException('Unable to find CustomFieldsGroup entity.'); } ...
php
{ "resource": "" }
q253706
CustomFieldsGroupController.getOptionsAvailable
validation
private function getOptionsAvailable($entity) { $options = $this->getParameter('chill_custom_fields.' . 'customizables_entities'); foreach($options as $key => $definition) { if ($definition['class'] == $entity) { foreach ($definition['option...
php
{ "resource": "" }
q253707
CustomFieldsGroupController.createEditForm
validation
private function createEditForm(CustomFieldsGroup $entity) { $form = $this->createForm('custom_fields_group', $entity, array( 'action' => $this->generateUrl('customfieldsgroup_update', array('id' => $entity->getId())), 'method' => 'PUT', )); $form->add('submit', 'subm...
php
{ "resource": "" }
q253708
CustomFieldsGroupController.renderFormAction
validation
public function renderFormAction($id, Request $request) { $em = $this->getDoctrine()->getManager(); $entity = $em->getRepository('ChillCustomFieldsBundle:CustomFieldsGroup')->find($id); if (!$entity) { throw $this->createNotFoundException('Unable to find CustomFieldsGroups ...
php
{ "resource": "" }
q253709
Temporary.getStream
validation
public function getStream($mediaId) { $response = $this->getHttp()->get(self::API_GET, ['media_id' => $mediaId]); $response->getBody()->rewind(); $body = $response->getBody()->getContents(); $json = json_decode($body, true); if (JSON_ERROR_NONE === json_last_error()) { ...
php
{ "resource": "" }
q253710
LumenAppNameCommand.replaceNamespace
validation
protected function replaceNamespace($path) { $search = [ 'namespace ' . $this->currentRoot . ';', $this->currentRoot . '\\' ]; $replace = [ 'namespace ' . $this->argument('name') . ';', $this->argument('name') . '\\' ...
php
{ "resource": "" }
q253711
LumenAppNameCommand.setAppConfigNamespaces
validation
protected function setAppConfigNamespaces() { $search = [ $this->currentRoot . '\\Providers', $this->currentRoot . '\\Http\\Controllers\\' ]; $replace = [ $this->argument('name') . '\\Providers', $this->argument('name') . '\\H...
php
{ "resource": "" }
q253712
LumenAppNameCommand.setDatabaseFactoryNamespaces
validation
protected function setDatabaseFactoryNamespaces() { $this->replaceIn($this->laravel->databasePath() . '/factories/ModelFactory.php', $this->currentRoot, $this->argument('name')); }
php
{ "resource": "" }
q253713
Module.isEnabled
validation
public static function isEnabled() { $class = self::className(); foreach (\Yii::$app->modules as $module => $params) { switch (gettype($params)) { case 'array' : if ($class == @$params['class']) return true; break; case 'object': if ($c...
php
{ "resource": "" }
q253714
Base.lookForPreMinifiedAsset
validation
private function lookForPreMinifiedAsset() { $min_path = (string)Str::s($this->file->getRealPath())->replace ( '.'.$this->file->getExtension(), '.min.'.$this->file->getExtension() ); if (!file_exists($min_path)) return false; return file_get_contents...
php
{ "resource": "" }
q253715
ThemeHandler.getTheme
validation
public function getTheme($identifier) { $themes = $this->getAvailableThemes(); if ( !isset($themes[$identifier]) ) { $themeIds = array(); foreach ($themes as $key => $value) { $themeIds[] = $key; } throw new \Exception(sprintf('Theme "%...
php
{ "resource": "" }
q253716
ThemeHandler.getCurrentTheme
validation
public function getCurrentTheme() { $theme = $this->getDefaultTheme(); if ( $this->container->get('session')->has('_admin_theme') ) { $theme = $this->container->get('session')->get('_admin_theme'); } return $theme; }
php
{ "resource": "" }
q253717
ThemeHandler.setCurrentTheme
validation
public function setCurrentTheme($identifier) { $theme = $this->getTheme($identifier); $this->container->get('session')->set('_admin_theme', $theme); }
php
{ "resource": "" }
q253718
FieldManager.getTransformation
validation
private function getTransformation() { $transforms = []; foreach ($this->fields as $field => $extra) { if (is_int($field)) { $transforms[$extra] = $extra; continue; } $transform = (key_exists('transform', $extra)) ? $ex...
php
{ "resource": "" }
q253719
ElFinderConnector.connect
validation
public function connect() { $this->loadConnectors(); $connector = new \elFinderConnector(new \elFinder($this->options)); $connector->run(); }
php
{ "resource": "" }
q253720
ElFinderConnector.generateOptions
validation
private function generateOptions($folder, $rootAlias) { $assetsPath = $this->configurationHandler->uploadAssetsDir() . '/' . $folder; if (!is_dir($assetsPath)) { @mkdir($assetsPath); } $options = array( 'locale' => '', 'roots' => array( ...
php
{ "resource": "" }
q253721
ThemeBase.findSlotsInTemplates
validation
protected function findSlotsInTemplates() { $templates = $this->findTemplates(); $slots = array(); foreach ($templates["base"] as $templateName => $templateFile) { $templateContents = FilesystemTools::readFile($templateFile); $slots = array_merge_recursive($slots, $th...
php
{ "resource": "" }
q253722
DoctrinePackage.registerServices
validation
public function registerServices(ServicesFactory $servicesFactory, array $entityManagers) { foreach ($entityManagers as $name => $entityManager) { //TODO: handle isDev depending on app config $emConfig = Setup::createAnnotationMetadataConfiguration( (array) $entityMan...
php
{ "resource": "" }
q253723
Calc.mapByGeneration
validation
private function mapByGeneration($mapByDepthDesc, $mapById) { $result = []; // [ $custId=>[$genId => $totalPv, ...], ... ] foreach ($mapByDepthDesc as $depth => $ids) { foreach ($ids as $custId) { /** @var EBonDwnl $entry */ $entry = $mapById[$custId]; ...
php
{ "resource": "" }
q253724
Calc.plainBonus
validation
private function plainBonus($bonus) { /* prepare data for updates */ $result = []; /** @var DEntry $item */ foreach ($bonus as $item) { $bonusData = $item->getEntries(); /** @var DBonus $entry */ foreach ($bonusData as $entry) { $bo...
php
{ "resource": "" }
q253725
Application.getDefaultOptionIds
validation
protected function getDefaultOptionIds() { $optionIds = []; $defaultDefinition = $this->getDefaultInputDefinition(); foreach ($defaultDefinition->getOptions() as $option) { $optionIds[] = $option->getName(); }; return $optionIds; }
php
{ "resource": "" }
q253726
Guesser.adapterHasBehavior
validation
public function adapterHasBehavior(Adapter $adapter, $behavior) { if ($adapter instanceof KnowsItsBehaviors) { return in_array($behavior, $adapter->getBehaviors()); } return true === is_a($adapter, $behavior); }
php
{ "resource": "" }
q253727
Guesser.allFromAdapter
validation
public function allFromAdapter(Adapter $adapter) { if ($adapter instanceof KnowsItsBehaviors) { return $adapter->getBehaviors(); } $rfl = new \ReflectionClass($adapter); $behaviors = array(); foreach ($rfl->getInterfaces() as $interface) { if (...
php
{ "resource": "" }
q253728
Log.enableLogging
validation
public static function enableLogging($writePath) { if (is_file($writePath)) { self::$enabled = true; self::$logFilePath = $writePath; return true; } throw new \Exception('Impossible d\'activer les logs dans le fichier '.$writePath.' : celui ci n\'existe pas.'); return false; ...
php
{ "resource": "" }
q253729
Log.write
validation
public static function write($output) { if (self::$enabled) { $d = new \DateTime(); $f = new File(self::$logFilePath, true); $f->write($d->format('d/m/Y H:i:s') . ' - ' . $output . "\n", true); } }
php
{ "resource": "" }
q253730
Log.setPath
validation
protected static function setPath($writePath) { if (is_file($writePath)) { self::$logFilePath = $writePath; return true; } throw new \Exception('Impossible de modifier la destination des logs : le fichier '.$writePath.' n\'existe pas.'); return false; }
php
{ "resource": "" }
q253731
Parser.select
validation
public static function select($select) { if (gettype($select)=="array") { foreach ($select as $key => $field) { if ($field instanceof Key) { $alias = '"'.$field.'"'; $field = self::field($field); $select[$key] = "{$fie...
php
{ "resource": "" }
q253732
Parser.where
validation
public static function where($field, $operator, $value, $logical) { if (gettype($field)=="array") { throw new ClusterpointException("\"->where()\" function: passed field selector is not in valid format.", 9002); } if ($operator===null) { return "{$logical} {$field} ";...
php
{ "resource": "" }
q253733
Parser.orderBy
validation
public static function orderBy($field, $order) { if (!$order) { $order = 'DESC'; } $order = strtoupper($order); if (!($order=='ASC' || $order=='DESC')) { throw new ClusterpointException("\"->order()\" function: ordering should be DESC or ASC.", 9002); ...
php
{ "resource": "" }
q253734
Parser.groupBy
validation
public static function groupBy($field) { if (!(gettype($field)=="string" || $field instanceof Key || $field instanceof Raw)) { throw new ClusterpointException("\"->group()\" function: passed field selector is not in valid format.", 9002); } if ($field instanceof Key) { ...
php
{ "resource": "" }
q253735
Parser.find
validation
public static function find($id = null, $connection) { if (gettype($id)!="string" && !is_numeric($id)) { throw new ClusterpointException("\"->find()\" function: \"_id\" is not in valid format.", 9002); } $connection->method = 'GET'; $connection->action = '['.urlencode($id...
php
{ "resource": "" }
q253736
Parser.get
validation
public static function get(Scope $scope, $connection, $multiple, $return = false) { $from = $connection->db; if (strpos($from, '.') !== false) { $tmp = explode('.', $connection->db); $from = end($tmp); } if (!is_null($scope->listWordsField)) { if ($scope->listWo...
php
{ "resource": "" }
q253737
Parser.delete
validation
public static function delete($id = null, $connection) { if (gettype($id)!="string" && !is_numeric($id)) { throw new ClusterpointException("\"->delete()\" function: \"_id\" is not in valid format.", 9002); } $connection->method = 'DELETE'; $connection->action = '['.urlenc...
php
{ "resource": "" }
q253738
Parser.deleteMany
validation
public static function deleteMany(array $ids = array(), $connection) { if (!is_array($ids)) { throw new ClusterpointException("\"->deleteMany()\" function: \"_id\" is not in valid format.", 9002); } $connection->method = 'DELETE'; $connection->action = ''; // for...
php
{ "resource": "" }
q253739
Parser.insertOne
validation
public static function insertOne($document, $connection) { $connection->query = self::singleDocument($document); return self::insert($connection); }
php
{ "resource": "" }
q253740
Parser.insertMany
validation
public static function insertMany($document, $connection) { if (gettype($document)!="array" && gettype($document)!="object") { throw new ClusterpointException("\"->insert()\" function: parametr passed ".json_encode(self::escape_string($document))." is not in valid document format.", 9002); ...
php
{ "resource": "" }
q253741
Parser.update
validation
public static function update($id, $document, $connection) { $from = $connection->db; if (strpos($from, '.') !== false) { $tmp = explode('.', $connection->db); $from = end($tmp); } $connection->method = 'PATCH'; $connection->action = '['.urlencode($id...
php
{ "resource": "" }
q253742
Parser.updateRecursion
validation
private static function updateRecursion($document) { $result = array(); foreach (self::toDotted($document, '', 1) as $path => $value) { $result[] = $path . $value; } return implode(' ', $result); }
php
{ "resource": "" }
q253743
Parser.replace
validation
public static function replace($id, $document, $connection) { $connection->query = self::singleDocument($document); $connection->method = 'PUT'; $connection->action = '['.urlencode($id).']'; return self::sendQuery($connection); }
php
{ "resource": "" }
q253744
Parser.beginTransaction
validation
public static function beginTransaction($connection) { $connection->query = 'BEGIN_TRANSACTION'; $connection->method = 'POST'; $connection->action = '/_query'; return self::sendQuery($connection); }
php
{ "resource": "" }
q253745
Parser.rollbackTransaction
validation
public static function rollbackTransaction($connection) { $connection->query = 'ROLLBACK'; $connection->method = 'POST'; $connection->action = '/_query'; return self::sendQuery($connection); }
php
{ "resource": "" }
q253746
Parser.commitTransaction
validation
public static function commitTransaction($connection) { $connection->query = 'COMMIT'; $connection->method = 'POST'; $connection->action = '/_query'; return self::sendQuery($connection); }
php
{ "resource": "" }
q253747
Parser.sendQuery
validation
public static function sendQuery(ConnectionInterface $connection) { $response = DataLayer::execute($connection); $connection->resetSelf(); return $response; }
php
{ "resource": "" }
q253748
Parser.singleDocument
validation
public static function singleDocument($document) { if (gettype($document)!="array" && gettype($document)!="object") { throw new ClusterpointException("\"->insert()\" function: parametr passed ".json_encode(self::escape_string($document))." is not in valid document format.", 9002); } ...
php
{ "resource": "" }
q253749
MessageBuilder.msgType
validation
public function msgType($msgType) { if (!in_array($msgType, $this->msgTypes, true)) { throw new InvalidArgumentException('This message type not exist.'); } $this->msgType = $msgType; return $this; }
php
{ "resource": "" }
q253750
MessageBuilder.build
validation
public function build() { if (empty($this->msgType)) { throw new RuntimeException('message type not exist.'); } if (empty($this->message)) { throw new RuntimeException('No message content to send.'); } // 群发视频消息给用户列表时,视频消息格式需要另外处理,具体见文档 if ($...
php
{ "resource": "" }
q253751
MessageBuilder.buildPreview
validation
public function buildPreview($by) { if (!in_array($by, $this->previewBys, true)) { throw new InvalidArgumentException('This preview by not exist.'); } if (empty($this->msgType)) { throw new RuntimeException('Message type not exist.'); } elseif ($this->msgType...
php
{ "resource": "" }
q253752
MessageBuilder.buildGroup
validation
private function buildGroup($group) { if (is_null($group)) { $group = [ 'filter' => [ 'is_to_all' => true, ], ]; } elseif (is_array($group)) { $group = [ 'touser' => $group, ]; ...
php
{ "resource": "" }
q253753
LoginForm.login
validation
public function login() { if ($this->validate()) { return \Yii::$app->getUser()->login($this->user, $this->rememberMe ? $this->module->rememberFor : 0); } else { return false; } }
php
{ "resource": "" }
q253754
Folder.copy
validation
public static function copy($src, $dest, $force=false, $delete=false) { $src = Path::clean($src); $dest = Path::clean($dest); $fs = new Filesystem(); try { $fs->mirror($src, $dest, null, [ 'override' => $force, 'delete' => $delete, 'copy_on_windows' => true ]); } catch(IOException...
php
{ "resource": "" }
q253755
Folder.create
validation
public static function create($path='', $mode=0777) { $path = Path::clean($path); $fs = new Filesystem(); try { $fs->mkdir($path); } catch(IOExceptionInterface $e){ throw new Exception(Helper::getTranslation('FAILED_CREATING').' '.$e->getPath()); } return true; }
php
{ "resource": "" }
q253756
Folder.exists
validation
public static function exists($path) { $path = Path::clean($path); $fs = new Filesystem(); return $fs->exists($path); }
php
{ "resource": "" }
q253757
Folder.delete
validation
public static function delete($path) { if ( !Folder::exists($path) ){ return true; } $path = Path::clean($path); if ( trim($path) === '' ){ throw new Exception(Helper::getTranslation('FAILED_DELETING').' : Cannot delete root path'); } $fs = new Filesystem(); ...
php
{ "resource": "" }
q253758
Folder.move
validation
public static function move($src, $dest, $overwrite=false) { $src = Path::clean($src); $dest = Path::clean($dest); if ( !Folder::exists($src) ){ throw new Exception(Helper::getTranslation('CANNOT_FIND_SOURCE').' : '.$src); } if ( Folder::exists($dest) ){ throw new Exception(...
php
{ "resource": "" }
q253759
Folder.files
validation
public static function files($path, $filter = '.', $recurse = false, $full = false, $exclude = array('.svn', 'CVS', '.DS_Store', '__MACOSX', 'Thumbs.db'), $excludefilter = array('^\..*', '.*~'), $naturalSort = true) { $path = Path::clean($path); if ( !is_dir($path) ){ throw new Exception(Helper::getTra...
php
{ "resource": "" }
q253760
Downline.getByCalcId
validation
public function getByCalcId($calcId) { $where = Entity::A_CALC_REF . '=' . (int)$calcId; $result = $this->get($where); return $result; }
php
{ "resource": "" }
q253761
DbSettingsMapper.getWhereFromParameter
validation
protected function getWhereFromParameter(ParameterInterface $parameter) { if ($parameter instanceof IdAwareParameterInterface && $parameter->getId()) { return ['id' => $parameter->getId()]; } else { return ['namespace' => $parameter->getNamespace(), 'name' => $parameter->getN...
php
{ "resource": "" }
q253762
CustomFieldRenderingTwig.renderLabel
validation
public function renderLabel($customFieldOrClass, $slug = null, array $params = array()) { $resolvedParams = array_merge($this->defaultParams, $params); $customField = ($customFieldOrClass instanceof CustomField) ? $customFieldOrClass : $this->container->get('chill.custom_field....
php
{ "resource": "" }
q253763
CustomFieldRenderingTwig.renderWidget
validation
public function renderWidget(array $fields, $customFieldOrClass, $documentType='html', $slug = null) { return $this->container->get('chill.custom_field.helper') ->renderCustomField($fields, $customFieldOrClass, $documentType, $slug); }
php
{ "resource": "" }
q253764
Command.update
validation
public function update(array $arguments = null, array $options = null): void { /* Update Arguments */ if ($arguments) { $keys = array_keys($this->arguments); for ($index = 0; $index < count($keys); $index++) { $this->arguments[$keys[$index]] = $arguments[$inde...
php
{ "resource": "" }
q253765
Template.deserializeJSON
validation
public function deserializeJSON($jsonString) { $data = json_decode($jsonString); $this->setContent($data->content); $this->setContext($data->context); }
php
{ "resource": "" }
q253766
SharedLock.release
validation
static function release( $token, $mode, $opts=array() ) { // just in case (is_file results might be cached!)... clearstatcache(); $lockDir = self::lockDir( $opts ); if ( $mode == LOCK_EX ) { $wLockFile = "$lockDir/{$token}_W.lock"; if ( is_fi...
php
{ "resource": "" }
q253767
SharedLock.cleanup
validation
static public function cleanup( $opts=array() ) { if ( strtoupper( substr( PHP_OS, 0, 3 ) ) == 'WIN' ) { exec( 'tasklist /FO CSV', $runningProcesses, $return_var ); $runningProcesses = array_map( function( $line ){ $cols = explode( ',', $line ); return t...
php
{ "resource": "" }
q253768
Module.getDataSources
validation
public function getDataSources() { if (is_null($this->_dataSources)) { $this->_dataSources = []; foreach ($this->dataSources() as $foreignModel => $dataSource) { if (is_numeric($foreignModel) || isset($dataSources['foreignModel'])) { if (!isset($da...
php
{ "resource": "" }
q253769
Module.getLocalDataSource
validation
public function getLocalDataSource($localModelClass) { foreach ($this->dataSources as $dataSource) { if ($dataSource->localModel === $localModelClass) { return $dataSource; } } return false; }
php
{ "resource": "" }
q253770
Module.getForeignDataSource
validation
public function getForeignDataSource($foreignModelClass) { foreach ($this->dataSources as $dataSource) { if ($dataSource->foreignModel->modelName === $foreignModelClass) { return $dataSource; } } return false; }
php
{ "resource": "" }
q253771
Device.apply
validation
public function apply($quantity, $reason, $comment = '', $poiId = null) { $params = [ 'quantity' => intval($quantity), 'apply_reason' => $reason, ]; if (!empty($comment)) { $params['comment'] = $comment; } if (!is_null($poiId)) { ...
php
{ "resource": "" }
q253772
Device.getStatus
validation
public function getStatus($applyId) { $params = [ 'apply_id' => intval($applyId), ]; return $this->parseJSON('json', [self::API_DEVICE_APPLYSTATUS, $params]); }
php
{ "resource": "" }
q253773
Device.update
validation
public function update(array $deviceIdentifier, $comment) { $params = [ 'device_identifier' => $deviceIdentifier, 'comment' => $comment, ]; return $this->parseJSON('json', [self::API_DEVICE_UPDATE, $params]); }
php
{ "resource": "" }
q253774
Device.bindLocation
validation
public function bindLocation(array $deviceIdentifier, $poiId, $type = 1, $poiAppid = null) { $params = [ 'device_identifier' => $deviceIdentifier, 'poi_id' => intval($poiId), ]; if ($type === 2) { if (is_null($poiAppid)) { throw new Invali...
php
{ "resource": "" }
q253775
Device.pagination
validation
public function pagination($lastSeen, $count) { $params = [ 'type' => 2, 'last_seen' => intval($lastSeen), 'count' => intval($count), ]; return $this->fetch($params); }
php
{ "resource": "" }
q253776
Device.fetchByApplyId
validation
public function fetchByApplyId($applyId, $lastSeen, $count) { $params = [ 'type' => 3, 'apply_id' => intval($applyId), 'last_seen' => intval($lastSeen), 'count' => intval($count), ]; return $this->fetch($params); }
php
{ "resource": "" }
q253777
SecurityController.authenticate
validation
public function authenticate(ClientInterface $client) { $attributes = $client->getUserAttributes(); $provider = $client->getId(); $clientId = $attributes['id']; $account = $this->finder->findAccountByProviderAndClientId($provider, $clientId); if ($account === null) { ...
php
{ "resource": "" }
q253778
RelatedObjects.setRelatedObjects
validation
public function setRelatedObjects($relatedObjects) { foreach ($relatedObjects as $modelName => $objects) { if (!isset($this->_relatedObjects[$modelName])) { $this->_relatedObjects[$modelName] = []; } foreach ($objects as $tabId => $objectAttributes) { ...
php
{ "resource": "" }
q253779
RelatedObjects.setRelations
validation
public function setRelations($value) { if ($this->companionObject) { $baseObject = $this->companionObject; } else { $baseObject = $this->owner; } $fields = $baseObject->getFields(); foreach ($value as $tabId => $relation) { if (!isset($rela...
php
{ "resource": "" }
q253780
Benri_Util_String.dasherize
validation
public static function dasherize($str, $replacement = '_') { return preg_replace_callback( '/([A-Z0-9-\s]+)/', function ($match) use ($replacement) { return $replacement . strtolower($match[1]); }, lcfirst($str) ); }
php
{ "resource": "" }
q253781
Benri_Util_String.camelize
validation
public static function camelize($str, $ucfirst = false) { $replace = str_replace( ' ', '', ucwords(str_replace(['_', '-'], ' ', strtolower($str))) ); if (!$ucfirst) { return lcfirst($replace); } return $replace; }
php
{ "resource": "" }
q253782
Benri_Util_String.random
validation
public static function random( $length = 8, $allowedChars = 'abcdefghjkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXY346789' ) { $return = ''; $hashLength = strlen($allowedChars) - 1; for (;$length > 0; --$length) { $return .= $allowedChars{rand(0, $hashLengt...
php
{ "resource": "" }
q253783
View.get
validation
public function get(): \TheCMSThread\Core\Main\View { if ($this->getLink() == '/') { $this->details = Model\Page::find(1); } else { $this->details = Model\Page::where('link', $this->getLink()); if ($this->auth->allow(["min" => 3, "max" => 1]) === false) { ...
php
{ "resource": "" }
q253784
View.getLink
validation
public function getLink(): string { if ($this->link === null) { return str_replace("?" . $_SERVER["QUERY_STRING"], "", $_SERVER["REQUEST_URI"]); } else { return $this->link; } }
php
{ "resource": "" }
q253785
View.setLink
validation
public function setLink(string $link = null): \TheCMSThread\Core\Main\View { $this->link = $link; return $this; }
php
{ "resource": "" }
q253786
Dispatcher.listen
validation
public function listen($event, callable $callback, $priority = 100) { $this->event->on($event, $callback, $priority); }
php
{ "resource": "" }
q253787
Dispatcher.once
validation
public function once($event, callable $callback, $priority = 100) { $this->event->once($event, $callback, $priority); }
php
{ "resource": "" }
q253788
PluginManager.getBlockPlugin
validation
public function getBlockPlugin($name) { if (!array_key_exists($name, $this->blocks)) { return null; } return $this->blocks[$name]; }
php
{ "resource": "" }
q253789
PluginManager.getThemePlugin
validation
public function getThemePlugin($name) { if (!array_key_exists($name, $this->themes)) { return null; } return $this->themes[$name]; }
php
{ "resource": "" }
q253790
PluginManager.boot
validation
public function boot() { $pluginFolders = $this->configurationHandler->pluginFolders(); $this->core = $this->findPlugins($this->configurationHandler->corePluginsDir() . "/Core"); foreach ($pluginFolders as $pluginFolder) { $this->blocks += $this->findPlugins($pluginFolder . "/Blo...
php
{ "resource": "" }
q253791
PluginManager.installAssets
validation
public function installAssets() { $this->doInstallAssets($this->core); $this->doInstallAssets($this->blocks); $this->doInstallAssets($this->themes); }
php
{ "resource": "" }
q253792
SerializedObject.isSerialized
validation
public function isSerialized() { // if it isn't a string, it isn't serialized if (!is_string($this->serialized)) { return false; } $this->serialized = trim($this->serialized); if ('N;' == $this->serialized) { return true; } $length = st...
php
{ "resource": "" }
q253793
Session.addHeaders
validation
private function addHeaders() { self::response()->addHeader('Cache-Control', 'no-cache, no-store, must-revalidate'); // HTTP 1.1 self::response()->addHeader('Pragma', 'no-cache'); // HTTP 1.0 self::response()->addHeader('Expires', '-1'); // Proxies }
php
{ "resource": "" }
q253794
FileUploaded.save
validation
public function save($path,$name=null){ if(!file_exists($path)){ mkdir($path,0777,true); } $destinationPath=rtrim($path, '/'); if($name){ $destinationPath.='/'.$name; } else{ $destinationPath.='/'.$this->name; } if(!copy($this->tmpName, $destinationPath)){ //detect error reason $reason=...
php
{ "resource": "" }
q253795
MMySQLCacheManager.createTable
validation
public function createTable() { $stmt = $this->pdoConnection->prepare( sprintf( self::$CREATE_TABLE, $this->tableName ) ); return $stmt->execute(); }
php
{ "resource": "" }
q253796
TagController.showAction
validation
public function showAction(Tag $tag) { $deleteForm = $this->createDeleteForm($tag); return array( 'entity' => $tag, 'delete_form' => $deleteForm->createView(), ); }
php
{ "resource": "" }
q253797
TagController.createDeleteForm
validation
private function createDeleteForm(Tag $tag) { return $this->createFormBuilder() ->setAction($this->generateUrl('blog_tag_delete', array('id' => $tag->getId()))) ->setMethod('DELETE') ->getForm() ; }
php
{ "resource": "" }
q253798
Flash.init
validation
private static function init() : void { static $inited = false; if (!$inited) { if (!isset($_SESSION['Booby']) || !$_SESSION['Booby']) { $_SESSION['Booby'] = []; } self::$store =& $_SESSION['Booby']; $inited = true; } }
php
{ "resource": "" }
q253799
ToolsController.actionFlush
validation
public function actionFlush($category = null) { if (is_null($category)) { $category = $this->prompt("Category (blank for all): "); } if (empty($category)) { $category = 'all'; } else { $category = ['category', $category]; } Cacher::...
php
{ "resource": "" }