idx int64 0 60.3k | question stringlengths 64 4.24k | target stringlengths 5 618 |
|---|---|---|
8,200 | private function handleFilters ( ExportInterface $ export , QueryBuilder $ qb , $ data , array $ centers ) { $ filters = $ this -> retrieveUsedFilters ( $ data ) ; foreach ( $ filters as $ alias => $ filter ) { if ( $ this -> isGrantedForElement ( $ filter , $ export , $ centers ) === false ) { throw new UnauthorizedHt... | alter the query with selected filters . |
8,201 | private function handleAggregators ( ExportInterface $ export , QueryBuilder $ qb , $ data , array $ center ) { $ aggregators = $ this -> retrieveUsedAggregators ( $ data ) ; foreach ( $ aggregators as $ alias => $ aggregator ) { $ formData = $ data [ $ alias ] ; $ aggregator -> alterQuery ( $ qb , $ formData [ 'form' ... | Alter the query with selected aggregators |
8,202 | public static function side ( $ items , $ htmlOptions = array ( ) ) { ArrayHelper :: addValue ( 'class' , Enum :: NAV_SIDE , $ htmlOptions ) ; ob_start ( ) ; echo \ CHtml :: openTag ( 'ul' , $ htmlOptions ) ; foreach ( $ items as $ item ) { if ( is_string ( $ item ) ) echo \ CHtml :: tag ( 'li' , array ( 'class' => Enu... | Generates a side nav |
8,203 | public static function sub ( $ items , $ htmlOptions = array ( ) ) { ArrayHelper :: addValue ( 'class' , Enum :: NAV_SUB , $ htmlOptions ) ; ob_start ( ) ; echo \ CHtml :: openTag ( 'dl' , $ htmlOptions ) ; foreach ( $ items as $ item ) { $ itemOptions = ArrayHelper :: getValue ( $ item , 'itemOptions' , array ( ) ) ; ... | Generates a foundation sub nav |
8,204 | public function boot ( ) { if ( ! $ this -> booted ) { foreach ( $ this -> container -> getProviders ( ) as $ provider ) { $ provider -> boot ( $ this ) ; } $ this -> booted = true ; } } | Boots of the all providers of the application |
8,205 | public function getAppDir ( ) { if ( null === $ this -> container -> getAppDir ( ) ) { $ r = new \ ReflectionObject ( $ this ) ; $ this -> container -> setAppDir ( str_replace ( '\\' , '/' , dirname ( $ r -> getFileName ( ) ) ) ) ; } return $ this -> container -> getAppDir ( ) ; } | Get Application Dir |
8,206 | public static function getInstance ( array $ userSettings = array ( ) ) { if ( ! self :: $ instance ) { self :: $ instance = new self ( $ userSettings ) ; } return self :: $ instance ; } | Get instance of MVC |
8,207 | public function group ( ) { $ args = func_get_args ( ) ; $ route = array_shift ( $ args ) ; $ callable = array_pop ( $ args ) ; if ( is_string ( $ route ) && is_callable ( $ callable ) ) { call_user_func ( $ callable , $ route ) ; } } | Add Group routes |
8,208 | public function ajax ( $ patternUri , $ action , $ name ) { $ route = new Route ( "ajax" , $ patternUri , $ action , $ name ) ; $ this -> container -> addRoute ( $ route ) ; return $ route ; } | Add AJAX route |
8,209 | public function registerProvider ( Provider $ provider ) { $ provider -> register ( $ this ) ; $ this -> container -> addProvider ( $ provider ) ; return $ this ; } | Register the providers |
8,210 | public function setRoutes ( ) { $ routesJsonFile = $ this -> getAppDir ( ) . '/config/routes.json' ; $ routesPhpFile = $ this -> getAppDir ( ) . '/config/routes.php' ; $ routes = array ( ) ; if ( file_exists ( $ routesJsonFile ) ) { $ routes [ ] = json_decode ( file_get_contents ( $ routesJsonFile ) , true ) ; } elseif... | Set Routes from JSON|PHP File |
8,211 | public static function share ( $ callable ) { if ( ! is_object ( $ callable ) || ! method_exists ( $ callable , '__invoke' ) ) { throw new InvalidArgumentException ( 'Callable is not a Closure or invokable object.' ) ; } return function ( $ c ) use ( $ callable ) { static $ object ; if ( null === $ object ) { $ object ... | Share a clousure object or callback object |
8,212 | public function urlFor ( $ path , $ type_name = 'asset' , array $ params = array ( ) ) { switch ( $ type_name ) { case 'asset' : return $ this -> container -> getRequest ( ) -> getRootUri ( ) . $ path ; break ; case 'route' : $ routeUrl = $ this -> container -> getRequest ( ) -> getRootUri ( $ this -> getSetting ( 'deb... | Return the url for the path given |
8,213 | public function data ( $ json = false ) { return ( $ json ) ? $ this -> container -> getRequest ( ) -> data -> JSON : $ this -> container -> getRequest ( ) -> data ; } | Get the data of request |
8,214 | function addAttachment ( $ data , $ filename = '' , $ contenttype = 'application/octet-stream' , $ cid = FALSE ) { if ( ! $ cid ) { $ cid = md5 ( uniqid ( time ( ) ) ) ; } $ info [ 'data' ] = $ data ; $ info [ 'filename' ] = $ filename ; $ info [ 'contenttype' ] = $ contenttype ; $ info [ 'cid' ] = $ cid ; $ this -> re... | adds a MIME attachment to the current request . |
8,215 | public function execute ( $ type ) { switch ( strtolower ( $ type ) ) { case 'markup' : $ curlOptArray = $ this -> getMarkupOpts ( ) ; break ; case 'file' : $ curlOptArray = $ this -> getFileOpts ( ) ; break ; case 'url' : $ curlOptArray = $ this -> getUrlOpts ( ) ; break ; default : throw new \ PHPUnit_Framework_Excep... | Will execute a cURL request . |
8,216 | protected function bindInstallCommand ( ) { $ this -> app [ 'package.install' ] = $ this -> app -> share ( function ( $ app ) { return $ app -> make ( 'Terion\PackageInstaller\PackageInstallCommand' ) ; } ) ; $ this -> app [ 'package.process' ] = $ this -> app -> share ( function ( $ app ) { return $ app -> make ( 'Ter... | Bind command to IoC |
8,217 | public function declareField ( string $ field , string $ type , string $ source , string $ origin = null ) { $ schema = $ this -> constant ( 'SCHEMA' ) -> getValue ( ) ; $ setters = $ this -> constant ( 'SETTERS' ) -> getValue ( ) ; $ validates = $ this -> constant ( 'VALIDATES' ) -> getValue ( ) ; if ( ! isset ( $ thi... | Add new field to request and generate default filters and validations if type presented in mapping . |
8,218 | public function route ( ) { $ uri = clone JUri :: getInstance ( ) ; $ router = $ this -> getRouter ( ) ; $ result = $ router -> parse ( $ uri ) ; foreach ( $ result as $ key => $ value ) { $ this -> input -> def ( $ key , $ value ) ; } JPluginHelper :: importPlugin ( 'system' ) ; $ this -> triggerEvent ( 'onAfterRoute'... | Route the application . |
8,219 | public function dispatch ( $ component = null ) { $ document = JFactory :: getDocument ( ) ; $ contents = JComponentHelper :: renderComponent ( $ component ) ; $ document -> setBuffer ( $ contents , 'component' ) ; JPluginHelper :: importPlugin ( 'system' ) ; $ this -> triggerEvent ( 'onAfterDispatch' ) ; } | Dispatch the application . |
8,220 | public function render ( ) { $ template = $ this -> getTemplate ( true ) ; $ params = array ( 'template' => $ template -> template , 'file' => 'index.php' , 'directory' => JPATH_THEMES , 'params' => $ template -> params ) ; $ document = JFactory :: getDocument ( ) ; $ document -> parse ( $ params ) ; JPluginHelper :: i... | Render the application . |
8,221 | public function getName ( ) { $ name = $ this -> _name ; if ( empty ( $ name ) ) { $ r = null ; if ( ! preg_match ( '/J(.*)/i' , get_class ( $ this ) , $ r ) ) { JLog :: add ( JText :: _ ( 'JLIB_APPLICATION_ERROR_APPLICATION_GET_NAME' ) , JLog :: WARNING , 'jerror' ) ; } $ name = strtolower ( $ r [ 1 ] ) ; } return $ n... | Method to get the application name . |
8,222 | public function getTemplate ( $ params = false ) { $ template = new stdClass ; $ template -> template = 'system' ; $ template -> params = new Registry ; if ( $ params ) { return $ template ; } return $ template -> template ; } | Gets the name of the current template . |
8,223 | protected function _createConfiguration ( $ file ) { JLoader :: register ( 'JConfig' , $ file ) ; $ config = new JConfig ; $ registry = JFactory :: getConfig ( ) ; $ registry -> loadObject ( $ config ) ; return $ config ; } | Create the configuration registry . |
8,224 | public function checkSession ( ) { $ db = JFactory :: getDbo ( ) ; $ session = JFactory :: getSession ( ) ; $ user = JFactory :: getUser ( ) ; $ query = $ db -> getQuery ( true ) -> select ( $ db -> quoteName ( 'session_id' ) ) -> from ( $ db -> quoteName ( '#__users_sessions' ) ) -> where ( $ db -> quoteName ( 'sessio... | Checks the user session . |
8,225 | public function afterSessionStart ( ) { $ session = JFactory :: getSession ( ) ; if ( $ session -> isNew ( ) ) { $ session -> set ( 'registry' , new Registry ( 'session' ) ) ; $ session -> set ( 'user' , new JUser ) ; } } | After the session has been started we need to populate it with some default values . |
8,226 | public function getColumnByName ( $ strColumnName ) { if ( $ this -> objColumnArray ) { foreach ( $ this -> objColumnArray as $ objColumn ) { if ( $ objColumn -> Name == $ strColumnName ) return $ objColumn ; } } return null ; } | return the SqlColumn object related to that column name |
8,227 | public function toArray ( ) { $ data = array ( 'added' => $ this -> getAdded ( true ) , 'api' => $ this -> getApi ( ) , 'cwd' => $ this -> getCwd ( true ) , 'debug' => $ this -> getDebug ( ) , 'files' => $ this -> getFiles ( true ) , 'list' => $ this -> getList ( ) , 'netDrivers' => $ this -> getNetDrivers ( ) , 'optio... | get response as array . |
8,228 | public function getAdded ( $ asArray = true ) { $ return = array ( ) ; if ( $ asArray && $ this -> added ) { foreach ( $ this -> added as $ file ) { $ return [ ] = $ file -> toArray ( ) ; } } return $ asArray ? $ return : $ this -> added ; } | get Added . |
8,229 | public function getCwd ( $ asArray = false ) { return $ this -> cwd && $ asArray ? $ this -> cwd -> toArray ( ) : $ this -> cwd ; } | get Current Working Directory . |
8,230 | public function getFiles ( $ asArray = false ) { $ return = array ( ) ; if ( $ asArray && $ this -> files ) { foreach ( $ this -> files as $ file ) { $ return [ ] = $ file -> toArray ( ) ; } } return $ asArray ? $ return : $ this -> files ; } | get Files . |
8,231 | public function getTree ( $ asArray = false ) { $ return = array ( ) ; if ( $ asArray && $ this -> tree ) { foreach ( $ this -> tree as $ file ) { $ return [ ] = $ file -> toArray ( ) ; } } return $ asArray ? $ return : $ this -> tree ; } | get Tree . |
8,232 | public static function register ( $ jsFile , $ alias = NULL , Array $ dependencies = array ( ) ) { return self :: getManager ( ) -> register ( $ jsFile , $ alias , $ dependencies ) ; } | Macht dem Standard JS Manager eine JS Datei bekannt |
8,233 | function getPlayer ( ) { $ player = self :: $ persistance -> getVariable ( 'player' ) ; if ( ! $ player ) { if ( $ this -> getAccessToken ( ) ) { $ player = $ this -> executeOAuth2 ( 'GET' , '/player/' ) ; self :: $ persistance -> setVariable ( 'player' , $ player ) ; } } return $ player ; } | This is the first method to call when you have an authorization code . It will retrieve an access token if possible and then call the service to retrieve a basic object about the authentified player . |
8,234 | public function renderAlert ( ) { $ user = \ Yii :: app ( ) -> user ; if ( count ( $ user -> getFlashes ( false ) ) == 0 ) { return ; } $ alerts = array ( ) ; foreach ( $ this -> config as $ style => $ config ) { if ( $ user -> hasFlash ( $ style ) ) { $ options = ArrayHelper :: getValue ( $ config , 'htmlOptions' , ar... | Renders the alert |
8,235 | public static function recursiveMkdir ( string $ dir , int $ loops = 0 ) { if ( $ loops > 20 ) throw new UtilException ( 'No more than 20 directories in a row' ) ; if ( ! file_exists ( $ newdir = dirname ( $ dir ) ) ) self :: recursiveMkdir ( $ newdir ) ; @ mkdir ( $ dir ) ; @ chmod ( $ dir , 0777 ) ; } | Warning! Ignoring warnings |
8,236 | public function locate ( $ entity , Request $ request , $ template = null ) { if ( ! $ template ) { $ template = 'TenelevenGeolocatorBundle::results.html.twig' ; } $ provider = $ this -> getLocationProvider ( $ entity ) ; $ form = $ this -> get ( 'form.factory' ) -> createNamed ( '' , $ provider -> getFilterFormType ( ... | Displays a geo - locator screen with map form and locations |
8,237 | protected function buildMap ( $ template , Search $ result ) { $ map = $ this -> getMap ( ) ; if ( ! $ result -> hasResults ( ) ) { $ map -> setCenter ( new Coordinate ( $ result -> getCenter ( ) -> getLatitude ( ) , $ result -> getCenter ( ) -> getLongitude ( ) ) ) ; return $ map ; } $ twigTemplate = $ this -> get ( '... | Builds a map of locations |
8,238 | public function validate ( $ value ) : void { switch ( $ this -> sqlType ) { case 'ENUM' : case 'SET' : break ; default : $ common = self :: TYPES [ $ this -> sqlType ] ; if ( ! $ this -> size ) $ this -> size = $ common ; else $ this -> size = min ( $ this -> size , $ common ) ; $ this -> getValidator ( ) :: apply ( '... | Checks if the type is correspondent |
8,239 | protected function renderNavigation ( ) { $ nav = array ( ) ; if ( ! empty ( $ this -> wrapperOptions ) ) { $ nav [ ] = \ CHtml :: openTag ( 'div' , $ this -> wrapperOptions ) ; } $ nav [ ] = \ CHtml :: openTag ( 'nav' , $ this -> htmlOptions ) ; $ nav [ ] = $ this -> renderTitle ( ) ; $ nav [ ] = $ this -> renderItems... | Renders the navigation |
8,240 | protected function renderTitle ( ) { $ items = array ( ) ; $ title = \ CHtml :: tag ( 'h1' , array ( ) , \ CHtml :: link ( $ this -> title , $ this -> titleUrl , $ this -> titleOptions ) ) ; $ items [ ] = \ CHtml :: tag ( 'li' , array ( 'class' => 'name' ) , $ title ) ; $ items [ ] = \ CHtml :: tag ( 'li' , array ( 'cl... | Renders the title of navigation |
8,241 | protected function renderItems ( ) { $ items = array ( ) ; if ( ! empty ( $ this -> leftItems ) ) { $ tItems = array ( ) ; foreach ( $ this -> leftItems as $ item ) { $ tItems [ ] = $ this -> renderItem ( $ item ) ; } $ items [ ] = \ CHtml :: openTag ( 'ul' , array ( 'class' => Enum :: POS_LEFT ) ) . implode ( "\n" , $... | Renders widget s items . |
8,242 | protected function renderItem ( $ item ) { if ( is_string ( $ item ) ) { return $ item ; } if ( ! isset ( $ item [ 'label' ] ) ) { throw new InvalidConfigException ( "The 'label' option is required." ) ; } $ label = $ this -> encodeLabels ? \ CHtml :: encode ( $ item [ 'label' ] ) : $ item [ 'label' ] ; $ options = Arr... | Renders a widget s item |
8,243 | function menu ( $ menus ) { $ user = Auth :: user ( ) ; $ templates = [ "menu" => ' <ul class="sidebar-menu" data-widget="tree"> %s </ul> ' , "menu_row" => ' <li class="%s"> %s </li> ' , "menu_caret" => ' <span class="pull-ri... | Format an AdminLTE Menu |
8,244 | public function prepareCriteria ( $ criteria ) { if ( is_null ( $ criteria ) ) { $ criteria = array ( ) ; } if ( array_key_exists ( '$id' , $ criteria ) ) { $ criteria [ 'id' ] = $ criteria [ '$id' ] ; unset ( $ criteria [ '$id' ] ) ; } return $ criteria ? : array ( ) ; } | comment for other criteria |
8,245 | public function getQueryReference ( $ key = '' , $ foreign = '' , $ foreignLabel = '' , $ foreignKey = '' , & $ i ) { $ model = Norm :: factory ( $ foreign ) ; $ refSchemes = $ model -> schema ( ) ; $ foreignKey = $ foreignKey ? : 'id' ; if ( $ foreignKey == '$id' ) { $ foreignKey = 'id' ; } $ query = $ key . ' IN (SEL... | Find reference of a foreign key . |
8,246 | public function replaceContents ( Array $ replacements ) { $ this -> writeContents ( str_replace ( array_keys ( $ replacements ) , array_values ( $ replacements ) , $ this -> getContents ( ) ) ) ; return $ this ; } | Replaces the contents of the file |
8,247 | private function set_field_names ( ) { foreach ( $ this -> config -> fields as $ field ) { $ field -> init_name = $ field -> name ; } } | Since the widget s form sets custom names and ids to each field the original field name must be stored seperately using this function . |
8,248 | public function form ( $ instance ) { foreach ( $ this -> config -> fields as $ field ) { $ field -> name = $ field -> init_name ; } $ this -> form -> updater -> set_new_instance ( $ instance ) ; $ this -> form -> updater -> update ( ) ; foreach ( $ this -> config -> fields as $ field ) { $ field -> id = $ this -> get_... | Generates the administration form for the widget |
8,249 | public function update ( $ new_instance , $ old_instance ) { $ this -> form -> updater -> set_new_instance ( $ new_instance ) ; return $ this -> form -> updater -> update ( $ old_instance ) ; } | Processes the widget s options to be saved . |
8,250 | private function validate_components ( $ components ) { foreach ( $ components as $ component ) { if ( ! $ component instanceof UI \ AbstractComponent ) { throw new WrongTypeException ( \ gettype ( $ component ) ) ; } if ( $ component instanceof UI \ Components \ Composite ) { $ this -> validate_components ( $ componen... | Internally used to validate each form component . |
8,251 | public function generateCommands ( array $ classes = [ ] ) { $ classes = $ this -> readApis ( $ classes ) ; $ token = $ this -> token -> read ( ) ; $ commands = [ ] ; foreach ( $ classes as $ class ) { $ api = new \ ReflectionClass ( $ class ) ; foreach ( $ api -> getMethods ( \ ReflectionMethod :: IS_PUBLIC ) as $ met... | generates Commands from all Api Methods . |
8,252 | private function buildDefinition ( \ ReflectionMethod $ method , $ token = null ) { $ definition = new InputDefinition ( ) ; foreach ( $ method -> getParameters ( ) as $ parameter ) { if ( $ parameter -> isDefaultValueAvailable ( ) ) { $ definition -> addOption ( new InputOption ( $ parameter -> getName ( ) , null , In... | builds the Input Definition based upon Api Method Parameters . |
8,253 | public static function handle ( ) { $ args = func_get_args ( ) ; $ key = array_shift ( $ args ) ; return call_user_func_array ( array ( static :: $ builder , 'build_' . $ key ) , $ args ) ; } | Handle a build request |
8,254 | static function getInstance ( $ methods , $ patternUri , $ action , $ name = null ) { if ( ! self :: $ instance ) { self :: $ instance = new self ( $ methods , $ patternUri , $ action , $ name ) ; } return self :: $ instance ; } | Get Route instance |
8,255 | public function setAction ( $ action ) { if ( ! is_string ( $ action ) && ! is_callable ( $ action ) ) { throw new \ LogicException ( sprintf ( 'Route action given "%s" is invalid. String or Callable expected.' , gettype ( $ action ) ) ) ; } $ this -> action = $ action ; return $ this ; } | Set action callback |
8,256 | protected function configure ( ) { $ sAppName = SystemSettings :: get ( 'app_name' ) ; $ this -> setName ( $ sAppName . ':remote:cron' ) -> addOption ( 'app' , null , InputOption :: VALUE_REQUIRED , 'run only for specific remote app' , false ) -> addOption ( 'force' , null , InputOption :: VALUE_NONE , 'force to run re... | configure cli command for making api calls |
8,257 | private function _parseCrontab ( $ sDatetime , $ sCrontab ) { $ aTime = explode ( ' ' , date ( 'i G j n w' , strtotime ( $ sDatetime ) ) ) ; $ sCrontab = explode ( ' ' , $ sCrontab ) ; foreach ( $ sCrontab as $ k => & $ v ) { $ v = explode ( ',' , $ v ) ; foreach ( $ v as & $ v1 ) { $ v1 = preg_replace ( array ( '/^\*$... | Parse cron time string |
8,258 | private function _makeCall ( $ oRemoteApp ) { $ this -> getContainer ( ) -> get ( 'API' ) ; Api :: $ _container = $ this -> getContainer ( ) ; $ aReturn = Api :: call ( 'getData' , array ( array ( 'log' => $ oRemoteApp -> getIncludelog ( ) , 'format' => 'json' ) ) , $ oRemoteApp -> getFullApiUrl ( ) , $ oRemoteApp -> g... | perform api call |
8,259 | private function _saveResponse ( $ aResponse , $ oRemoteApp ) { $ sClassName = '\Slashworks\AppBundle\Model\RemoteHistory' . ucfirst ( $ oRemoteApp -> getType ( ) ) ; $ sQueryClassName = '\Slashworks\AppBundle\Model\RemoteHistory' . ucfirst ( $ oRemoteApp -> getType ( ) . 'Query' ) ; if ( class_exists ( $ sClassName ) ... | Save response to database |
8,260 | private function _sendErrorNotification ( & $ oRemoteApp , $ aResponse ) { $ iStatusCode = $ aResponse [ 'statuscode' ] ; if ( $ iStatusCode === 404 ) { $ sHtml = $ this -> getContainer ( ) -> get ( 'templating' ) -> render ( 'SlashworksAppBundle:Email:cron_error_404_notification.html.twig' , array ( 'remote_app' => $ ... | Send Error - Notification to user |
8,261 | private function _sendNotification ( $ aDiff , & $ oRemoteApp , $ aNewHistory ) { $ sHtml = $ this -> getContainer ( ) -> get ( 'templating' ) -> render ( 'SlashworksAppBundle:Email:cron_notification.html.twig' , array ( 'diff' => $ aDiff , 'log' => $ aNewHistory [ 'Log' ] , 'remote_app' => $ oRemoteApp , 'controlurl' ... | Send Notification to user |
8,262 | public function isExpired ( ) { if ( ! FS :: isFile ( $ this -> _resultFile ) ) { return true ; } $ fileAge = abs ( time ( ) - filemtime ( $ this -> _resultFile ) ) ; if ( $ fileAge >= $ this -> _cache_ttl ) { return true ; } $ firstLine = trim ( FS :: firstLine ( $ this -> _resultFile ) ) ; $ expected = trim ( $ this ... | Check is current cache is expired |
8,263 | public function save ( $ content ) { $ content = $ this -> _getHeader ( ) . $ content ; $ result = file_put_contents ( $ this -> _resultFile , $ content ) ; if ( ! $ result ) { throw new Exception ( 'JBZoo/Less: File not save - ' . $ this -> _resultFile ) ; } } | Save result to cache |
8,264 | public function subscribe ( Forum $ forum , User $ user , $ selfActivation = true ) { $ this -> om -> startFlushSuite ( ) ; $ notification = new Notification ( ) ; $ notification -> setUser ( $ user ) ; $ notification -> setForum ( $ forum ) ; $ notification -> setSelfActivation ( $ selfActivation ) ; $ this -> om -> p... | Subscribe a user to a forum . A mail will be sent to the user each time a message is posted . |
8,265 | public function sendMessageNotification ( Message $ message , User $ user ) { $ forum = $ message -> getSubject ( ) -> getCategory ( ) -> getForum ( ) ; $ notifications = $ this -> notificationRepo -> findBy ( array ( 'forum' => $ forum ) ) ; $ users = array ( ) ; foreach ( $ notifications as $ notification ) { $ users... | Send a notification to a user about a message . |
8,266 | public function moveMessage ( Message $ message , Subject $ newSubject ) { $ this -> om -> startFlushSuite ( ) ; $ oldSubject = $ message -> getSubject ( ) ; $ message -> setSubject ( $ newSubject ) ; $ this -> om -> persist ( $ message ) ; $ this -> dispatch ( new MoveMessageEvent ( $ message , $ oldSubject , $ newSub... | Move a message to an other subject . |
8,267 | public function moveSubject ( Subject $ subject , Category $ newCategory ) { $ this -> om -> startFlushSuite ( ) ; $ oldCategory = $ subject -> getCategory ( ) ; $ subject -> setCategory ( $ newCategory ) ; $ this -> om -> persist ( $ subject ) ; $ this -> dispatch ( new MoveSubjectEvent ( $ subject , $ oldCategory , $... | Move a subject to an other category . |
8,268 | public function stickSubject ( Subject $ subject ) { $ this -> om -> startFlushSuite ( ) ; $ subject -> setIsSticked ( true ) ; $ this -> om -> persist ( $ subject ) ; $ this -> dispatch ( new StickSubjectEvent ( $ subject ) ) ; $ this -> om -> endFlushSuite ( ) ; } | Stick a subject at the top of the subject list . |
8,269 | public function unstickSubject ( Subject $ subject ) { $ this -> om -> startFlushSuite ( ) ; $ subject -> setIsSticked ( false ) ; $ this -> om -> persist ( $ subject ) ; $ this -> dispatch ( new UnstickSubjectEvent ( $ subject ) ) ; $ this -> om -> endFlushSuite ( ) ; } | Unstick a subject from the top of the subject list . |
8,270 | public function closeSubject ( Subject $ subject ) { $ this -> om -> startFlushSuite ( ) ; $ subject -> setIsClosed ( true ) ; $ this -> om -> persist ( $ subject ) ; $ this -> dispatch ( new CloseSubjectEvent ( $ subject ) ) ; $ this -> om -> endFlushSuite ( ) ; } | Close a subject and no one can write in it . |
8,271 | public function openSubject ( Subject $ subject ) { $ this -> om -> startFlushSuite ( ) ; $ subject -> setIsClosed ( false ) ; $ this -> om -> persist ( $ subject ) ; $ this -> dispatch ( new OpenSubjectEvent ( $ subject ) ) ; $ this -> om -> endFlushSuite ( ) ; } | Open a subject . |
8,272 | public function getSubjectsPager ( Category $ category , $ page = 1 , $ max = 20 ) { $ subjects = $ this -> forumRepo -> findSubjects ( $ category ) ; return $ this -> pagerFactory -> createPagerFromArray ( $ subjects , $ page , $ max ) ; } | Get the pager for the subject list of a category . |
8,273 | public function getMessagesPager ( Subject $ subject , $ page = 1 , $ max = 20 ) { $ messages = $ this -> messageRepo -> findBySubject ( $ subject ) ; return $ this -> pagerFactory -> createPagerFromArray ( $ messages , $ page , $ max ) ; } | Get the pager for the message list of a subject . |
8,274 | public function searchPager ( Forum $ forum , $ search , $ page ) { $ query = $ this -> forumRepo -> search ( $ forum , $ search ) ; return $ this -> pagerFactory -> createPager ( $ query , $ page ) ; } | Get the pager for the forum search . |
8,275 | protected function _prepareHeaders ( ) { $ headers = array ( ) ; if ( ! isset ( $ this -> headers [ 'host' ] ) ) { $ host = $ this -> uri -> getHost ( ) ; if ( ! ( ( $ this -> uri -> getScheme ( ) == 'http' && $ this -> uri -> getPort ( ) == 80 ) || ( $ this -> uri -> getScheme ( ) == 'https' && $ this -> uri -> getPor... | Prepare the request headers |
8,276 | protected function resolve ( $ action , $ params ) { if ( $ action instanceof Closure ) { return $ action ( $ params ) ; } list ( $ controller , $ method ) = $ action ; $ reflect = new ReflectionClass ( $ controller ) ; foreach ( array_filter ( $ reflect -> getMethod ( $ method ) -> getParameters ( ) , $ this -> getPar... | Method injection resolver |
8,277 | public function compile ( Report $ report , bool $ skipExec = false ) { $ sourceFullPath = $ report -> getSourceFile ( ) ; $ compiledPath = $ this -> compiledPath ; $ this -> shellCommand = $ this -> executablePath . " cp -o $compiledPath $sourceFullPath" ; if ( ! $ skipExec ) { $ oldcwd = getcwd ( ) ; chdir ( $ this -... | Compile JRXML files into JASPER for processing . |
8,278 | public function process ( Report $ report , bool $ skipExec = false ) { $ compiledFullPath = $ this -> compiledPath . DIRECTORY_SEPARATOR . pathinfo ( $ report -> getSourceFile ( ) , PATHINFO_FILENAME ) . '.jasper' ; $ processedFullPath = $ this -> processedPath . DIRECTORY_SEPARATOR . uniqid ( 'ASB' ) ; $ format = ' -... | Process JASPER file into PDF or similar output format . |
8,279 | protected function processCsvFileOptions ( Report $ report ) { $ value = $ report -> getFile ( 'file' ) ; $ csvSwitch = "--data-file $value " ; $ value = $ report -> getCsvfile ( 'columnHeaderNames' ) ; if ( empty ( $ value ) ) { $ csvSwitch .= '--csv-first-row ' ; } else { $ csvSwitch .= "--csv-columns " . implode ( '... | Process CSV file details |
8,280 | public static function getRoot ( ) { if ( ! isset ( self :: $ root ) ) { try { $ root = getenv ( 'PSC_CMS' ) ; if ( ! empty ( $ root ) ) { return self :: $ root = new Dir ( $ root ) ; } } catch ( \ Webforge \ Common \ System \ Exception $ e ) { } throw MissingEnvironmentVariableException :: factory ( 'PSC_CMS' , 'The v... | Returns the root directory of the host where the host - config lives |
8,281 | public static function createKey ( ? string $ msgid , ? string $ msgctxt = null , ? string $ msgid_plural = null ) : string { $ key = '' ; if ( ! empty ( $ msgctxt ) ) { $ key .= $ msgctxt . '|' ; } $ key .= ( string ) $ msgid ; if ( ! empty ( $ msgid_plural ) ) { $ key .= '|' . $ msgid_plural ; } return $ key ; } | Build the internal entries array key from id context and plural id |
8,282 | public function createKeyFromEntry ( PoEntry $ entry ) : string { return $ this -> createKey ( $ entry -> getAsString ( PoTokens :: MESSAGE ) , $ entry -> getAsString ( PoTokens :: CONTEXT ) , $ entry -> getAsString ( PoTokens :: PLURAL ) ) ; } | Build an internal entries array key from a PoEntry |
8,283 | public function addEntry ( PoEntry $ entry , bool $ replace = true ) : bool { $ key = $ this -> createKeyFromEntry ( $ entry ) ; if ( empty ( $ key ) ) { $ this -> unkeyedEntries [ ] = $ entry ; return true ; } if ( isset ( $ this -> entries [ $ key ] ) && ! $ replace ) { return false ; } else { $ this -> entries [ $ k... | Add an entry to the PoFile using internal key |
8,284 | public function mergeEntry ( PoEntry $ newEntry ) : bool { $ key = $ this -> createKeyFromEntry ( $ newEntry ) ; if ( empty ( $ key ) ) { return false ; } if ( isset ( $ this -> entries [ $ key ] ) ) { $ existingEntry = $ this -> entries [ $ key ] ; $ mergeTokens = array ( PoTokens :: REFERENCE , PoTokens :: EXTRACTED_... | Merge an entry with any existing entry with the same key . If the key does not exist add the entry otherwise merge comments references and flags . |
8,285 | public function findEntry ( string $ msgid , ? string $ msgctxt = null , ? string $ msgid_plural = null ) : ? PoEntry { $ key = $ this -> createKey ( $ msgid , $ msgctxt , $ msgid_plural ) ; $ entry = null ; if ( ! empty ( $ key ) && isset ( $ this -> entries [ $ key ] ) ) { $ entry = $ this -> entries [ $ key ] ; } re... | Get an entry based on key values - msgid msgctxt and msgid_plural |
8,286 | public function removeEntry ( PoEntry $ entry ) : bool { $ key = $ this -> createKeyFromEntry ( $ entry ) ; if ( ! empty ( $ key ) && isset ( $ this -> entries [ $ key ] ) ) { if ( $ entry === $ this -> entries [ $ key ] ) { unset ( $ this -> entries [ $ key ] ) ; return true ; } } foreach ( $ this -> entries as $ key ... | Remove an entry from the PoFile |
8,287 | public function writePoFile ( string $ file ) : void { $ source = $ this -> dumpString ( ) ; $ testName = file_exists ( $ file ) ? $ file : dirname ( $ file ) ; $ status = is_writable ( $ testName ) ; if ( $ status === true ) { $ status = file_put_contents ( $ file , $ source ) ; } if ( false === $ status ) { throw new... | Write any current contents to a po file |
8,288 | public function dumpString ( ) : string { if ( $ this -> header === null ) { $ this -> header = new PoHeader ; $ this -> header -> buildDefaultHeader ( ) ; } $ output = '' ; $ output .= $ this -> header -> dumpEntry ( ) ; foreach ( $ this -> entries as $ entry ) { $ output .= $ entry -> dumpEntry ( ) ; } foreach ( $ th... | Dump the current contents in PO format to a string |
8,289 | public function readPoFile ( string $ file , ? resource $ context = null ) : void { $ oldEr = error_reporting ( E_ALL ^ E_WARNING ) ; $ source = file_get_contents ( $ file , false , $ context ) ; error_reporting ( $ oldEr ) ; if ( false === $ source ) { throw new FileNotReadableException ( $ file ) ; } $ this -> parseP... | Replace any current contents with entries from a file |
8,290 | public function addTemplatePath ( $ path ) { if ( is_array ( $ this -> templatesPath ) ) { if ( array_search ( $ path , $ this -> templatesPath ) ) { throw new \ LogicException ( sprintf ( 'Templates path "%s" exists.' , $ path ) ) ; } else { $ this -> templatesPath [ ] = $ path ; } } else if ( is_string ( $ this -> te... | Add Template Path |
8,291 | public function render ( $ file , $ vars = null ) { $ template = '' ; if ( is_null ( $ this -> templatesPath ) ) { throw new \ LogicException ( 'Variable "templatesPath" can\'t be NULL.' ) ; } else if ( is_string ( $ this -> templatesPath ) && ! file_exists ( $ this -> templatesPath ) ) { throw new \ LogicException ( s... | Renders a given file with the supplied variables . |
8,292 | public function setMode ( $ arg ) { $ this -> mode = strtolower ( $ arg ) == self :: LIVE ? self :: LIVE : self :: SANDBOX ; return $ this ; } | IS TEST OR LIVE |
8,293 | public function registr ( $ place , $ controller ) { if ( preg_match ( '/^[a-z0-9]+:[a-z0-9]+:[_a-z0-9]+$/i' , $ controller ) ) { if ( ! isset ( $ this -> widgets [ $ place ] ) ) { $ this -> widgets [ $ place ] [ ] = $ controller ; } elseif ( ! in_array ( $ controller , $ this -> widgets [ $ place ] ) ) { $ this -> wid... | Regist widget . |
8,294 | private function hash_equals ( $ knownString , $ userString ) { if ( function_exists ( '\hash_equals' ) ) { return \ hash_equals ( $ knownString , $ userString ) ; } if ( strlen ( $ knownString ) !== strlen ( $ userString ) ) { return false ; } $ len = strlen ( $ knownString ) ; $ result = 0 ; for ( $ i = 0 ; $ i < $ l... | Prevent timing attack |
8,295 | public function getParserFactory ( ) : ? ParserFactory { if ( ! $ this -> hasParserFactory ( ) ) { $ this -> setParserFactory ( $ this -> getDefaultParserFactory ( ) ) ; } return $ this -> parserFactory ; } | Get parser factory |
8,296 | public function render ( $ model , array $ fields = [ ] , $ element = self :: DEFAULT_ELEMENT , array $ data = [ ] ) { $ data = Hash :: merge ( [ 'clearUrl' => [ ] , 'model' => $ model , 'formFields' => $ fields , ] , $ data ) ; return $ this -> _View -> element ( $ element , $ data ) ; } | Render filter element . |
8,297 | public function executeProcedure ( $ strProcName , $ params = null ) { $ strParams = '' ; if ( $ params ) { $ a = array_map ( function ( $ val ) { return $ this -> sqlVariable ( $ val ) ; } , $ params ) ; $ strParams = implode ( ',' , $ a ) ; } $ strSql = "call {$strProcName}({$strParams})" ; return $ this -> multiQuer... | Generic stored procedure executor . For Mysql 5 you can have your stored procedure return results by SELECT ing the results . The results will be returned as an array . |
8,298 | public function addField ( string $ name , $ value ) { $ schema = $ this -> constant ( 'SCHEMA' ) -> getValue ( ) ; $ schema [ $ name ] = $ value ; $ this -> constant ( 'SCHEMA' ) -> setValue ( $ schema ) ; } | Add field into schema . |
8,299 | public function boot ( Container $ app ) { $ toBoot = ( array ) $ app [ 'config' ] -> get ( 'bootstrap' , [ ] ) ; foreach ( $ toBoot as $ bootstrapClass ) { $ app -> make ( $ bootstrapClass ) -> boot ( $ app ) ; } } | Call any other bootstraps defined by config . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.