idx
int64
0
60.3k
question
stringlengths
92
4.62k
target
stringlengths
7
635
5,800
private function showlist ( ) { $ this -> getMessage ( 'help' ) ; foreach ( $ this -> options as $ opt ) { echo "\n" ; echo "\t \t \t" , $ this -> log ( " " . $ opt [ 'name' ] . " => " . $ opt [ 'description' ] . " " , 'success' ) ; echo "\n" ; } }
Show Commands List .
5,801
public function bootstrap ( $ input ) { $ this -> getMessage ( 'welcome' ) ; if ( $ this -> hasInput ( $ input ) ) { $ in = $ input [ 1 ] ; $ this -> getMessage ( 'starttask' ) ; if ( in_array ( $ in , $ this -> getOptions ( ) ) ) { $ key = $ this -> searchForName ( $ in , $ this -> options ) ; foreach ( $ this -> opti...
Provide a start application .
5,802
public function markReadOnly ( ) : void { $ this -> readOnly = true ; foreach ( $ this -> data as $ value ) { if ( $ value instanceof self ) { $ value -> markReadOnly ( ) ; } } }
Marks this Config instance as readOnly
5,803
public static function Chain ( $ Type , $ Formatter , $ Priority = Gdn_FormatterChain :: PRIORITY_DEFAULT ) { $ Formatter = Gdn :: Factory ( $ Type . 'Formatter' ) ; if ( $ Formatter === NULL ) { $ Chain = new Gdn_FormatterChain ( ) ; Gdn :: FactoryInstall ( $ Type . 'Formatter' , 'Gdn_FormatterChain' , __FILE__ , Gdn ...
Add a formatter and create a chain in the Gdn factory . This is a conveinience method for chaining formatters without having to deal with the object creation logic .
5,804
public function Format ( $ String ) { $ Result = $ String ; foreach ( $ this -> _Formatters as $ FArray ) { $ Result = $ FArray [ 0 ] -> Format ( $ Result ) ; } return $ Result ; }
Format a string with all of the formatters in turn .
5,805
public function open ( callable $ callback ) { $ sessionHandleList = $ this -> getSessionWindowHandles ( ) ; $ callback ( $ this -> driver ) ; for ( $ i = 0 ; $ i < 10 ; $ i ++ ) { $ handle = $ this -> getNewWindow ( $ sessionHandleList ) ; if ( $ handle === null ) { sleep ( 1 ) ; } else { $ this -> setWindowHandle ( $...
Waiting for new window after callback executes .
5,806
public function getCurrentWindowHandle ( ) { $ command = $ this -> driver -> factoryCommand ( 'window_handle' , WebDriver_Command :: METHOD_GET ) ; $ result = $ this -> driver -> curl ( $ command ) ; return $ result [ 'value' ] ; }
Get the current active window handle . It may differ from this object window handle .
5,807
protected function getNewWindow ( $ sessionHandleList ) { $ newSessionHandleList = $ this -> getSessionWindowHandles ( ) ; $ sessionHandleCount = count ( $ sessionHandleList ) ; $ newSessionHandleCount = count ( $ newSessionHandleList ) ; $ newWindowHandleList = array_diff ( $ newSessionHandleList , $ sessionHandleList...
Get new window handle .
5,808
public function focus ( ) { $ params = [ 'name' => $ this -> windowHandle ] ; $ command = $ this -> driver -> factoryCommand ( 'window' , WebDriver_Command :: METHOD_POST , $ params ) ; $ this -> driver -> curl ( $ command ) ; return $ this ; }
Set this window active
5,809
public function close ( ) { $ params = [ 'name' => $ this -> windowHandle ] ; $ command = $ this -> driver -> factoryCommand ( 'window' , WebDriver_Command :: METHOD_DELETE , $ params ) ; $ this -> driver -> curl ( $ command ) ; return $ this ; }
Close this window
5,810
public function getSize ( ) { $ command = $ this -> driver -> factoryCommand ( 'window/' . $ this -> windowHandle . '/size' , WebDriver_Command :: METHOD_GET ) ; $ value = $ this -> driver -> curl ( $ command ) [ 'value' ] ; return [ 'height' => $ value [ 'height' ] , 'width' => $ value [ 'width' ] ] ; }
Get the size of the specified window .
5,811
public function setSize ( $ width , $ height ) { $ params = [ 'width' => intval ( $ width ) , 'height' => intval ( $ height ) ] ; $ command = $ this -> driver -> factoryCommand ( 'window/' . $ this -> windowHandle . '/size' , WebDriver_Command :: METHOD_POST , $ params ) ; return $ this -> driver -> curl ( $ command ) ...
Change the size of the specified window .
5,812
public function maximize ( ) { $ command = $ this -> driver -> factoryCommand ( 'window/' . $ this -> windowHandle . '/maximize' , WebDriver_Command :: METHOD_POST ) ; return $ this -> driver -> curl ( $ command ) [ 'value' ] ; }
Maximize the specified window if not already maximized .
5,813
public function setPosition ( $ left , $ top ) { $ params = [ 'x' => intval ( $ left ) , 'y' => intval ( $ top ) ] ; $ command = $ this -> driver -> factoryCommand ( 'window/' . $ this -> windowHandle . '/position' , WebDriver_Command :: METHOD_POST , $ params ) ; return $ this -> driver -> curl ( $ command ) [ 'value'...
Change the position of the specified window .
5,814
public function getElementLabel ( $ elementName ) { if ( $ label = $ this -> getSetting ( $ elementName , 'label' ) ) { return ( string ) $ label ; } return ucwords ( str_replace ( '_' , ' ' , $ elementName ) ) ; }
Get element label from settings array or default value
5,815
public function getElementType ( $ elementName ) { if ( $ this -> settingExists ( $ elementName ) ? $ type = $ this -> getSetting ( $ elementName , 'type' ) : false ) { return ( string ) $ type ; } return 'string' ; }
Get element type from settings array if not exist type is string
5,816
public function isElementHidden ( $ elementName ) { if ( $ this -> settingExists ( $ elementName ) ? $ settings = $ this -> getSetting ( $ elementName ) : false ) { if ( isset ( $ settings [ 'hidden' ] ) && $ settings [ 'hidden' ] == true ) { return true ; } } return false ; }
Is element hidden
5,817
public function changedColumnIs ( $ column ) { if ( ! $ this -> recordExists ( ) ) { return true ; } elseif ( $ this -> _recordAccess ( $ column ) && $ this -> _changedColumnAccess ( $ column ) ) { return $ this -> recordColumnGet ( $ column ) != $ this -> changeRecordData [ $ column ] ; } else { return true ; } }
Returns whether record has been change since the last save .
5,818
protected function checkPath ( $ path ) { $ dir = dirname ( realpath ( $ path ) ) ; if ( ! is_dir ( $ dir ) ) { mkdir ( $ dir , 0777 , true ) ; } if ( ! is_dir ( $ dir ) || ! is_writable ( $ dir ) ) { throw new LogicException ( Message :: get ( Message :: MSG_PATH_NONWRITABLE , $ dir ) , Message :: MSG_PATH_NONWRITABLE...
Check file path
5,819
protected function doRotation ( $ path , $ type ) { switch ( $ type ) { case self :: ROTATE_NONE : return true ; case self :: ROTATE_DATE : return $ this -> rotateByDate ( $ path ) ; default : return $ this -> rotateBySize ( $ path , $ type ) ; } }
Rotate file on start
5,820
public function make ( $ view , $ style = null ) { $ viewPath = $ this -> viewFinder -> find ( $ view ) ; try { $ stylePath = $ this -> styleFinder -> find ( $ style ? : $ view ) ; } catch ( InvalidArgumentException $ e ) { $ stylePath = null ; } return new View ( $ this -> viewParser , $ viewPath , $ this -> stylePars...
Make a view object
5,821
public function updatePartners ( $ e ) { $ partnersArray = $ e -> getParam ( 'partners' ) ; $ partnerService = $ e -> getTarget ( ) -> getServiceManager ( ) -> get ( 'playgroundpartnership_partner_service' ) ; $ partners = $ partnerService -> getActivepartners ( ) ; foreach ( $ partners as $ partner ) { $ partnersArray...
This method get the partners and add them as array to PlaygroundGame form so that there is non adherence between modules ... not that satisfied
5,822
public function get ( $ key , $ default = null ) { if ( ! array_key_exists ( $ key , $ this -> settings ) ) { if ( is_null ( $ default ) ) { throw new InvalidKeyException ( ) ; } return $ default ; } return $ this -> settings [ $ key ] ; }
Get configuration from repository
5,823
protected function download ( ) { $ this -> data_url = $ this -> job [ 'data' ] [ 'sources' ] [ $ this -> job [ 'done' ] ] ; $ filename = md5 ( $ this -> data_url ) ; $ destination = gplcart_file_private_module ( 'installer' , "$filename.zip" , true ) ; $ result = $ this -> file_transfer -> download ( $ this -> data_ur...
Download a module file from a remote source
5,824
protected function countErrors ( ) { $ count = 0 ; foreach ( $ this -> errors as $ url => $ errors ) { $ errors = array_filter ( $ errors ) ; $ count += count ( $ errors ) ; $ this -> logErrors ( $ url , $ errors ) ; } return $ count ; }
Returns a total number of errors and logs them
5,825
protected function logErrors ( $ url , array $ errors ) { $ data = array ( $ url , implode ( PHP_EOL , $ errors ) ) ; return gplcart_file_csv ( $ this -> job [ 'log' ] [ 'errors' ] , $ data ) ; }
Logs all errors happened for the URL
5,826
protected function setError ( $ error ) { settype ( $ error , 'array' ) ; $ existing = empty ( $ this -> errors [ $ this -> data_url ] ) ? array ( ) : $ this -> errors [ $ this -> data_url ] ; $ this -> errors [ $ this -> data_url ] = gplcart_array_merge ( $ existing , $ error ) ; }
Sets a error
5,827
public function refresh ( $ request ) { $ area = $ request -> param ( 'Area' ) ; if ( $ area != __FUNCTION__ && in_array ( str_replace ( '-' , '_' , $ area ) , $ this -> allowedActions ( ) ) ) { return RequestHandler :: handleAction ( $ request , str_replace ( '-' , '_' , $ area ) ) ; } if ( ! $ request -> isAjax ( ) )...
Grab available notifications
5,828
public function make ( $ data ) { $ parts = $ this -> splitData ( $ data [ 'data' ] , [ 'meta' , 'body' ] ) ; $ meta = self :: parseYaml ( $ parts [ 'meta' ] ) ; return $ this -> createAndFill ( [ 'id' => $ data [ 'id' ] , 'title' => $ meta [ 'title' ] , 'date' => $ data [ 'date' ] , 'data' => isset ( $ meta [ 'data' ]...
Transform raw data to an entity
5,829
public function flush ( $ flushDatabase = true ) { $ this -> temporary = array ( ) ; $ this -> temporarystart = array ( ) ; $ this -> log = array ( ) ; $ this -> start = microtime ( true ) ; \ Neuron \ DB \ Database :: getInstance ( ) -> flushLog ( ) ; }
Flush everything down the drain .
5,830
public function parse ( array $ arguments ) { $ preparedArguments = [ ] ; $ argumentsLength = count ( $ arguments ) ; for ( $ i = 1 ; $ i < $ argumentsLength ; $ i ++ ) { $ currentArgument = $ arguments [ $ i ] ; if ( substr ( $ currentArgument , 0 , 2 ) === '--' ) { $ name = substr ( $ currentArgument , 2 ) ; if ( str...
Parse CLI arguments
5,831
public function Fetch ( $ Table = FALSE , $ Database = NULL ) { if ( $ Table !== FALSE ) $ this -> CurrentTable = $ Table ; if ( ! is_array ( $ this -> _Schema ) ) $ this -> _Schema = array ( ) ; if ( ! array_key_exists ( $ this -> CurrentTable , $ this -> _Schema ) ) { if ( $ Database !== NULL ) { $ SQL = $ Database -...
Fetches the schema for the requested table . If it does not exist yet it will connect to the database and define it .
5,832
public function GetField ( $ Field , $ Table = '' ) { if ( $ Table != '' ) $ this -> CurrentTable = $ Table ; if ( ! is_array ( $ this -> _Schema ) ) $ this -> _Schema = array ( ) ; $ Result = FALSE ; if ( $ this -> FieldExists ( $ this -> CurrentTable , $ Field ) === TRUE ) $ Result = $ this -> _Schema [ $ this -> Cur...
Returns a the entire field object .
5,833
public function get ( $ entityId ) { $ key = $ this -> getEntityDescriptor ( ) -> className ( ) ; $ key .= '::' . $ entityId ; $ entity = $ this -> getIdentityMap ( ) -> get ( $ key , false ) ; if ( $ entity === false ) { $ entity = $ this -> load ( $ entityId ) ; } return $ entity ; }
Gets an entity by its id
5,834
protected function load ( $ entityId ) { $ table = $ this -> getEntityDescriptor ( ) -> getTableName ( ) ; $ primaryKey = $ this -> getEntityDescriptor ( ) -> getPrimaryKey ( ) -> getField ( ) ; return $ this -> find ( ) -> where ( [ "{$table}.{$primaryKey} = :id" => [ ':id' => $ entityId ] ] ) -> first ( ) ; }
Loads entity from database
5,835
public function loadYamlFile ( $ filePath ) { if ( file_exists ( $ filePath ) ) { $ this -> loadYaml ( file_get_contents ( $ filePath ) ) ; return $ this ; } return $ this ; }
Load a YAML file .
5,836
public function loadYaml ( $ yaml ) { $ data = Yaml :: parse ( $ yaml ) ; $ this -> keyStore = array_replace_recursive ( $ this -> keyStore , $ data ) ; $ this -> rebuildPathStore ( ) ; return $ this ; }
Load YAML .
5,837
private function rebuildPathStore ( ) { $ this -> pathStore = $ this -> pathNodes ( $ this -> keyStore ) ; $ this -> replaceTokens ( $ this -> pathStore ) ; }
Rebuild the path store .
5,838
protected function getUriParam ( $ key ) { if ( isset ( $ this -> uriParams [ $ key ] ) ) { return $ this -> uriParams [ $ key ] ; } else { return NULL ; } }
Devuelve un uri param si existe y si no devuelve NULL
5,839
protected function forward ( $ uri , $ filter = FALSE ) { $ this -> context -> app -> httpCore -> executeHttpRequest ( NULL , $ uri , $ filter ) ; }
Redireccion interna a otro Controlador . Se indica si se debe filtrar o no la nueva solicitud
5,840
public function positiveMatch ( $ name , $ subject , array $ arguments ) { return $ this -> validateCheckerConditionsAndThrowFailureExceptionOnFailedCheck ( $ this -> positiveCheck , $ arguments , $ this -> positiveError ) ; }
Uses positive check instance for validating match
5,841
public function negativeMatch ( $ name , $ subject , array $ arguments ) { return $ this -> validateCheckerConditionsAndThrowFailureExceptionOnFailedCheck ( $ this -> negativeCheck , $ arguments , $ this -> negativeError ) ; }
Uses negative check instance for validating match
5,842
private function validateCheckerConditionsAndThrowFailureExceptionOnFailedCheck ( CheckInterface $ checker , array $ arguments , $ errorText ) { $ validatorData = $ checker ( $ arguments ) ; if ( $ validatorData !== true ) { if ( is_array ( $ validatorData ) ) { throw new FailureException ( sprintf ( $ errorText , ... ...
Validates a checker
5,843
public function getPageUrlAttribute ( ) { return route ( 'page' , [ app ( ) -> getLocale ( ) , get_translation_name ( 'slug' , app ( ) -> getLocale ( ) , $ this -> translations -> toArray ( ) ) ] ) ; }
Get page url
5,844
public function removeCachedMenu ( ) { $ menuTypeIds = $ this -> menu_items ( ) -> pluck ( 'menu_type_id' ) -> unique ( ) -> all ( ) ; foreach ( $ menuTypeIds as $ menuTypeId ) { MenuHelper :: clearCache ( $ menuTypeId , app ( ) -> getLocale ( ) ) ; } }
Remove cached menu
5,845
public function serialize ( $ object ) { if ( ! $ this -> canHandle ( get_class ( $ object ) ) ) { throw new \ InvalidArgumentException ( ) ; } return [ $ object -> getTimestamp ( ) , $ object -> getTimezone ( ) ] ; }
Serialize the object
5,846
public function deserialize ( array $ serialized , $ fqcn ) { if ( ! $ this -> canHandle ( $ fqcn ) ) { throw new \ InvalidArgumentException ( ) ; } return $ fqcn :: createFromFormat ( 'U' , $ serialized [ 0 ] , $ serialized [ 1 ] ) ; }
Deserialize the object
5,847
protected function renderManagerFile ( EntityStackConfiguration $ configuration ) { $ intercessionClass = $ this -> makeManagerIntercessionClass ( $ configuration ) ; $ dir = $ configuration -> getEntityDir ( ) ; if ( ! is_writable ( $ dir ) ) { throw new NotWritableException ( $ dir ) ; } $ this -> getGenerator ( ) ->...
Renders the manager file
5,848
protected function makeRepositoryIntercessionClass ( EntityStackConfiguration $ configuration ) { $ intercessionClass = new IntercessionClass ( ) ; $ intercessionClass -> setName ( $ configuration -> getRepositoryName ( ) ) ; $ intercessionClass -> setNamespace ( $ configuration -> getRepositoryNamespace ( ) ) ; $ inte...
Makes the intercession class for the repository
5,849
protected function renderRepositoryFile ( EntityStackConfiguration $ configuration ) { $ intercessionClass = $ this -> makeRepositoryIntercessionClass ( $ configuration ) ; $ this -> getGenerator ( ) -> createClassDefinitionFile ( $ intercessionClass , $ configuration -> getRepositoryPath ( ) ) ; }
Renders the repository file
5,850
public function getLayoutsForSelect ( ) { if ( ! $ this -> _layoutsInitialized ) { $ this -> _initLayouts ( ) ; } $ results = [ ] ; foreach ( $ this -> _layouts as $ layout ) { $ results [ $ layout -> id ( ) ] = $ layout -> name ( ) ; } return $ results ; }
Get all layouts of this theme for a form select input .
5,851
public function getLayout ( $ id ) { if ( ! $ this -> _layoutsInitialized ) { $ this -> _initLayout ( $ id ) ; } if ( ! isset ( $ this -> _layouts [ $ id ] ) ) { throw new Exception ( __d ( 'wasabi_cms' , 'Layout "{0}" for theme "{1}" does not exist.' , $ id , $ this -> id ( ) ) ) ; } return $ this -> _layouts [ $ id ]...
Get a single layout by id .
5,852
public function getNameForViewBuilder ( ) { list ( $ plugin , ) = namespaceSplit ( get_class ( $ this ) ) ; $ plugin = preg_replace ( '/\\\/' , '/' , $ plugin ) ; return $ plugin ; }
Get the theme name for use in view builder .
5,853
public function getViewClassNameForViewBuilder ( ) { list ( $ plugin , $ theme ) = namespaceSplit ( get_class ( $ this ) ) ; $ plugin = preg_replace ( '/\\\/' , '/' , $ plugin ) ; return $ plugin . '.' . $ theme ; }
Get the view class name for use in view builder .
5,854
protected function _initLayouts ( ) { $ layouts = [ ] ; if ( method_exists ( $ this , 'registerLayouts' ) ) { $ layouts = $ this -> registerLayouts ( ) ; } foreach ( $ layouts as $ layout ) { $ this -> _initLayout ( $ layout ) ; } }
Initialize all layouts for the current theme .
5,855
protected function _initLayout ( $ layout ) { list ( $ theme , ) = namespaceSplit ( get_class ( $ this ) ) ; $ layoutClass = $ theme . '\\View\\Layout\\' . $ layout . 'Layout' ; try { $ layout = new $ layoutClass ( ) ; } catch ( Exception $ e ) { throw new Exception ( __d ( 'wasabi_cms' , 'The layout "{0}" could not be...
Initialize a single layout .
5,856
public function display ( $ sName = null , \ Apollina \ Template $ oTemplate = null ) { if ( $ oTemplate !== null ) { if ( $ this -> _oTemplateLink !== null ) { $ aVar = $ this -> getAllAssign ( ) ; $ aVar = array_merge ( $ aVar , $ this -> _oTemplateLink -> getAllAssign ( ) ) ; $ this -> assignAll ( $ aVar ) ; } } $ s...
show the template
5,857
public function fetch ( $ sName = null , $ bMainCall = true ) { if ( $ this -> _bIsMobile ) { if ( $ sName ) { $ sMobileTpl = self :: $ _sBasePath . str_replace ( '.tpl' , 'Mobile.tpl' , $ sName ) ; if ( file_exists ( $ sMobileTpl ) ) { $ sName = str_replace ( '.tpl' , 'Mobile.tpl' , $ sName ) ; } } if ( isset ( $ this...
fetch the template
5,858
private function _includeTransform2 ( $ aMatch ) { $ sViewDirectory = self :: $ _sBasePath ; eval ( '$oTemplate = new \Apollina\Template("' . self :: $ _sBasePath . $ aMatch [ 1 ] . '"); $oTemplate->fetch(null, false);' ) ; return '<?php include "' . $ this -> sTmpDirectory . '".md5("' . $ aMatch [ 1 ] . '").".cac.php"...
get the encode name od the template
5,859
public function unhandled ( Request $ request , Exception $ exception ) { $ debug = false ; if ( function_exists ( 'config' ) ) { $ debug = config ( 'app.debug' ) ; } elseif ( function_exists ( 'env' ) ) { $ debug = env ( 'APP_DEBUG' ) ; } if ( $ debug == true ) { $ whoops = new \ Whoops \ Run ; if ( $ request -> wants...
Default implementation for unhandled exceptions hands them back to the Laravel exception system .
5,860
protected function dispatch ( Request $ request , Exception $ exception ) { if ( property_exists ( $ this , 'catchers' ) == false ) { throw new RuntimeException ( 'No handlers defined to dispatch the exception on.' ) ; } $ type = get_class ( $ exception ) ; if ( property_exists ( $ this , 'blacklist' ) ) { if ( in_arra...
Dispatch an exception to the appropriate handler . If no appropriate handler is found the unhandled method is called .
5,861
public function reverseTransform ( $ id ) { if ( null == $ id ) { return null ; } $ entity = $ this -> contentManager -> getRepository ( ) -> find ( $ id ) ; return $ entity ; }
Transforms an id to entity
5,862
public function run ( array $ parameters ) { if ( ! isset ( $ parameters [ 0 ] ) ) { throw new ConsoleException ( 'Need a cache name to flush a cache!' ) ; } $ this -> app -> make ( CacheManager :: class ) -> flush ( $ parameters [ 0 ] ) ; $ this -> result ( "Cache '" . $ parameters [ 0 ] . "' has been flushed!" ) ; }
runs the command .
5,863
public static function _init ( ) { \ Config :: load ( 'simpleauth' , true ) ; if ( \ Config :: get ( 'simpleauth.remember_me.enabled' , false ) ) { static :: $ remember_me = \ Session :: forge ( array ( 'driver' => 'cookie' , 'cookie' => array ( 'cookie_name' => \ Config :: get ( 'simpleauth.remember_me.cookie_name' , ...
Load the config and setup the remember - me session if needed
5,864
public function get_user_id ( ) { if ( empty ( $ this -> user ) ) { return false ; } return array ( $ this -> id , ( int ) $ this -> user [ 'id' ] ) ; }
Get the user s ID
5,865
public function get ( $ field , $ default = null ) { if ( isset ( $ this -> user [ $ field ] ) ) { return $ this -> user [ $ field ] ; } elseif ( isset ( $ this -> user [ 'profile_fields' ] ) ) { return $ this -> get_profile_fields ( $ field , $ default ) ; } return $ default ; }
Getter for user data
5,866
public function get_profile_fields ( $ field = null , $ default = null ) { if ( empty ( $ this -> user ) ) { return false ; } if ( isset ( $ this -> user [ 'profile_fields' ] ) ) { is_array ( $ this -> user [ 'profile_fields' ] ) or $ this -> user [ 'profile_fields' ] = ( @ unserialize ( $ this -> user [ 'profile_field...
Get the user s profile fields
5,867
public function has_access ( $ condition , $ driver = null , $ user = null ) { if ( is_null ( $ user ) ) { $ groups = $ this -> get_groups ( ) ; $ user = reset ( $ groups ) ; } return parent :: has_access ( $ condition , $ driver , $ user ) ; }
Extension of base driver method to default to user group instead of user id
5,868
public function initializeObject ( ) { parent :: initializeObject ( ) ; $ this -> setPathsFromOptions ( ) ; $ this -> setFormat ( 'html' ) ; $ renderingContent = new RenderingContext ; $ renderingContent -> setControllerContext ( $ this -> controllerContext ) ; $ this -> setRenderingContext ( $ renderingContent ) ; }
Initialize paths from settings .
5,869
public function render ( $ templateName = null ) { if ( $ templateName === null ) { throw new InvalidArgumentException ( 'An template name is required and will be search relative from configured templates path' ) ; } $ this -> setTemplateName ( $ templateName ) ; return parent :: render ( $ templateName ) ; }
Loads the template source and render the template .
5,870
public function setPathsFromOptions ( $ optionsPath = 'AtomicKitten.Framework.build.source.framework' ) { $ configuration = $ this -> objectManager -> get ( ConfigurationManager :: class ) -> getConfiguration ( ConfigurationManager :: CONFIGURATION_TYPE_SETTINGS , $ optionsPath ) ; $ this -> setLayoutRootPath ( $ confi...
Set all needed paths by reading configured configuration .
5,871
public function handleError ( $ code , $ description , $ file = null , $ line = null , $ context = null ) { $ type = $ this -> mapErrorCode ( $ code ) [ 0 ] . ' Error: ' ; if ( ! $ this -> debug && ! in_array ( $ code , $ this -> _skipErrors ) ) $ this -> _email ( 'CLI Error' , Misc :: dump ( [ 'type' => rtrim ( $ type...
Intercept error handling to send a mail before continuing with the default logic
5,872
protected static function getMainElement ( \ DOMDocument $ html ) { $ content = $ html -> getElementsByTagName ( 'main' ) ; if ( $ content -> length !== 0 ) { return $ content -> item ( 0 ) ; } $ content = $ html -> getElementById ( 'main' ) ? : $ html -> getElementById ( 'content' ) ? : $ html -> getElementById ( 'pag...
Returns the main element of the document
5,873
static function getList ( $ lang ) { global $ config ; $ query = sprintf ( file_get_contents ( 'sql/getListPages.sql' ) , mysql_real_escape_string ( $ lang ) ) ; $ query = $ config -> connexionBdd -> requete ( $ query ) ; $ result = array ( ) ; while ( $ row = mysql_fetch_assoc ( $ query ) ) { array_push ( $ result , $...
Get the list of all pages
5,874
function add ( $ title , $ text , $ menu , $ footer , $ lang , $ id = null ) { global $ config ; $ this -> title = $ title ; $ this -> content = $ text ; if ( isset ( $ id ) ) { $ query = sprintf ( file_get_contents ( "sql/addPageID.sql" ) , mysql_real_escape_string ( $ title ) , mysql_real_escape_string ( $ text ) , m...
Ajouter une page
5,875
protected function buildInsertSet ( $ prefix , array $ settings ) { if ( empty ( $ this -> set_data ) ) { return '' ; } $ cols = [ ] ; foreach ( array_keys ( $ this -> set_col ) as $ col ) { $ cols [ ] = $ this -> quote ( $ col , $ settings ) ; } return $ settings [ 'seperator' ] . '(' . join ( ', ' , $ cols ) . ')' ; ...
Build SET for INSERT
5,876
protected function buildUpdateSet ( $ prefix , array $ settings ) { $ result = [ ] ; foreach ( $ this -> set_data [ 0 ] as $ col => $ val ) { if ( ClauseInterface :: NO_VALUE === $ val ) { $ result [ ] = $ col ; } else { $ result [ ] = $ this -> quote ( $ col , $ settings ) . ' = ' . $ this -> processValue ( $ val , $ ...
Build SET ... = ... ... = ...
5,877
protected function authenticate ( ) { if ( empty ( $ this -> username ) || empty ( $ this -> authMethod ) ) { throw new ConfigurationException ( sprintf ( 'Missing authentication parameters. Method: "%s", username "%s".' , $ this -> authMethod , $ this -> username ) ) ; } $ authMethodMap = array ( 'http-token' => Clien...
Add authentication to GitHub API requests .
5,878
public function fire ( ) { $ this -> line ( 'Setting up iron queueing...' ) ; try { $ this -> call ( 'queue:subscribe' , [ 'queue' => $ this -> laravel [ 'config' ] [ 'queue.connections.iron.queue' ] , 'url' => $ this -> laravel [ 'url' ] -> to ( 'queue/receive' ) , ] ) ; $ this -> info ( 'Queueing is now setup!' ) ; }...
Run the commend .
5,879
public function register ( ) { register_post_type ( $ this -> slug , [ 'labels' => $ this -> labels , 'public' => $ this -> public , 'has_archive' => $ this -> has_archive , 'menu_icon' => 'dashicons-' . $ this -> icon , 'supports' => $ this -> supports , 'rewrite' => [ 'slug' => $ this -> rewrite -> slug , 'with_front...
Register the post type .
5,880
private function setLabels ( ) { $ this -> labels = [ 'name' => ucwords ( $ this -> plural ) , 'singular_name' => ucwords ( $ this -> singular ) , 'menu_name' => ucwords ( $ this -> plural ) , 'name_admin_bar' => ucwords ( $ this -> singular ) , 'add_new' => 'Add New' , 'add_new_item' => 'Add New ' . ucwords ( $ this -...
Set the post - type s label up .
5,881
public function filterPostTypeLink ( $ permalink , $ item , $ leavename ) { if ( get_post_type ( $ item -> ID ) == $ this -> singular ) { $ terms = wp_get_post_terms ( $ item -> ID , $ this -> taxonomy ) ; $ term = ( $ terms ) ? $ terms [ 0 ] -> term_id : false ; $ permalink = $ this -> postTypePermalink ( $ item -> ID...
Alter post - type s links .
5,882
public function postTypePermalink ( $ itemId , $ catId = false , $ noName = false , $ onlyUrl = false ) { $ post = get_post ( $ postId ) ; $ permalink = get_term_link ( intval ( $ catId ) , $ this -> taxonomy ) ; $ permalink = ( $ catId ) ? trailingslashit ( $ permalink ) : home_url ( '/' . $ this -> plural . '/' ) ; $...
Return the correct permalink based on the rewrite rules .
5,883
public function search ( $ keyword , $ postsPerPage = false , $ paginate = true ) { $ page = get_query_var ( 'paged' ) ? get_query_var ( 'paged' ) : 1 ; $ args = [ 'post_type' => $ this -> slug , 'paged' => $ page , 's' => $ keyword ] ; if ( $ postsPerPage != false ) { $ args [ 'posts_per_page' ] = $ postsPerPage ; } $...
Search the post type using a keyword .
5,884
public function getMiddleLayoutModel ( ) { if ( null === $ this -> middleLayoutModel ) { $ this -> middleLayoutModel = $ this -> getServiceLocator ( ) -> get ( 'Grid\Paragraph\Model\Paragraph\MiddleLayoutModel' ) ; } return $ this -> middleLayoutModel ; }
Get middle - layout - model
5,885
public function injectMetaContent ( MvcEvent $ event ) { $ result = $ event -> getResult ( ) ; if ( ! $ result instanceof MetaContent ) { return ; } $ middle = $ this -> getMiddleLayoutModel ( ) ; $ paragraph = $ middle -> getParagraphModel ( ) ; $ renderList = $ paragraph -> findRenderList ( $ result -> getName ( ) ) ...
Insert the meta content into the view model
5,886
public function run ( $ paths = [ ] , array $ options = [ ] ) { $ this -> notes = [ ] ; $ files = $ this -> getMigrationFiles ( $ paths ) ; $ this -> requireFiles ( $ migrations = $ this -> pendingMigrations ( $ files , $ this -> executedMigrations ( ) ) ) ; $ this -> runPending ( $ migrations , $ options ) ; return $ ...
Run the pending migrations at a given path .
5,887
protected function executedMigrations ( ) { $ result = [ ] ; foreach ( $ this -> getRepository ( ) -> get ( ) as $ row ) { $ result [ ] = $ row [ 'migration' ] ; } return $ result ; }
Get list of migration executed .
5,888
public function addPaths ( array $ dirs = [ ] ) { foreach ( $ dirs as $ key => $ val ) { $ this -> data [ 'dir.' . $ key ] = $ val ; } }
Adds file paths to a storage
5,889
public function addUrls ( array $ urls = [ ] ) { foreach ( $ urls as $ key => $ val ) { $ this -> data [ 'url.' . $ key ] = $ val ; } }
Adds urls to a storage
5,890
private function checkDefaults ( array $ definition , string $ prefix = '' , string $ glue = '.' ) { if ( ! empty ( $ definition [ 'controls' ] ) ) { foreach ( $ definition [ 'controls' ] as $ name => $ control ) { $ key = ( ! empty ( $ prefix ) ? $ prefix . $ glue : '' ) . $ name ; $ this -> structure [ $ key ] = $ co...
Sets config default values
5,891
protected function updateKeys ( ) { if ( is_array ( $ this -> mixValue ) ) { $ this -> _arrKeys = array_keys ( $ this -> mixValue ) ; } else { $ this -> _arrKeys = array ( ) ; } }
Update Keys Method
5,892
public function setCompiler ( Compiler $ compiler ) { $ this -> compiler = $ compiler ; $ this -> compiler -> setParser ( $ this ) ; return $ this ; }
Setter for the compiler instance .
5,893
public function setConfigFile ( $ configFile = '' ) { if ( ! is_readable ( $ configFile ) ) { $ this -> activeConfig = [ ] ; throw ParserException :: forFileUnreadable ( $ configFile ) ; } $ this -> configFile = $ configFile ; if ( ! $ this -> parseConfigFile ( ) ) { throw InvalidConfigException :: forEmptyConfig ( $ c...
Setter for the config file to parse .
5,894
protected function beforeExplode ( $ config ) { foreach ( $ this -> server -> getBeforeMethods ( ) as $ beforeMethod ) { $ config = Before :: $ beforeMethod ( $ config ) ; } return $ config ; }
Does some extra parsing before the active config turns into an array .
5,895
protected function afterExplode ( array $ activeConfig ) { foreach ( $ this -> server -> getAfterMethods ( ) as $ afterMethod ) { $ activeConfig = After :: $ afterMethod ( $ activeConfig ) ; } return $ activeConfig ; }
Does some extra parsing after the active config has turned into an array .
5,896
private function parseConfigFile ( ) { $ activeConfig = $ this -> getOriginalConfig ( ) ; $ activeConfig = $ this -> beforeExplode ( $ activeConfig ) ; $ activeConfig = explode ( "\n" , $ activeConfig ) ; $ this -> activeConfig = $ this -> afterExplode ( $ activeConfig ) ; return ! empty ( $ this -> activeConfig ) ; }
Comon parsing to both apache and nginx .
5,897
public function plugin ( string $ name ) : \ TheCMSThread \ Classes \ Plugin { return $ this -> plugins -> get ( $ name ) ; }
Returns the active plugin object of given name
5,898
public function run ( ) : string { $ result = ( string ) $ this -> plugins -> runAll ( ) ; $ result .= ( string ) $ this -> theme ( ) -> run ( ) ; return $ result ; }
Runs the system handler
5,899
protected function getOptions ( InputInterface $ input ) { $ opts = array ( ) ; foreach ( $ this -> sshOptionOptions as $ key => $ option ) { if ( $ input -> getOption ( $ key ) ) { $ opts [ $ option ] = $ input -> getOption ( $ key ) ; } } if ( $ input -> getOption ( 'keyfile' ) ) { $ opts [ 'PasswordAuthentication' ]...
Convert console command options to ssh_options .