idx int64 0 60.3k | question stringlengths 101 6.21k | target stringlengths 7 803 |
|---|---|---|
58,800 | public function doFrontEndLogin ( $ user = null , $ password = null ) { if ( is_null ( $ user ) ) { $ user = $ this -> config [ 'username' ] ; } if ( is_null ( $ password ) ) { $ password = $ this -> config [ 'password' ] ; } $ this -> debug ( 'I open Joomla Frontend Login Page' ) ; $ this -> amOnPage ( $ this -> locat... | Function to Do Frontend Login In Joomla! |
58,801 | public function doFrontendLogout ( ) { $ this -> debug ( 'I open Joomla Frontend Login Page' ) ; $ this -> amOnPage ( $ this -> locator -> frontEndLoginUrl ) ; $ this -> debug ( 'I click Logout button' ) ; $ this -> click ( $ this -> locator -> frontEndLogoutButton ) ; $ this -> amOnPage ( '/index.php?option=com_users&... | Function to Do frontend Logout in Joomla! |
58,802 | public function installJoomlaRemovingInstallationFolder ( $ databaseName = null , $ databasePrefix = null ) { $ this -> installJoomla ( $ databaseName , $ databasePrefix ) ; $ this -> debug ( 'Removing Installation Folder' ) ; $ this -> click ( array ( 'xpath' => "//input[@value='Remove \"installation\" folder']" ) ) ;... | Install Joomla removing the Installation folder at the end of the execution |
58,803 | public function installJoomlaMultilingualSite ( $ languages = array ( ) , $ databaseName = null , $ databasePrefix = null ) { if ( ! $ languages ) { $ languages [ ] = 'French' ; } $ this -> installJoomla ( $ databaseName , $ databasePrefix ) ; $ this -> debug ( 'I go to Install Languages page' ) ; $ this -> click ( arr... | Installs Joomla with Multilingual Feature active |
58,804 | public function installExtensionFromFolder ( $ path , $ type = 'Extension' ) { $ this -> amOnPage ( '/administrator/index.php?option=com_installer' ) ; $ this -> waitForText ( 'Extensions: Install' , '30' , array ( 'css' => 'H1' ) ) ; $ this -> click ( array ( 'link' => 'Install from Folder' ) ) ; $ this -> debug ( 'I ... | Installs a Extension in Joomla that is located in a folder inside the server |
58,805 | public function installExtensionFromUrl ( $ url , $ type = 'Extension' ) { $ this -> amOnPage ( '/administrator/index.php?option=com_installer' ) ; $ this -> waitForText ( 'Extensions: Install' , '30' , array ( 'css' => 'H1' ) ) ; $ this -> click ( array ( 'link' => 'Install from URL' ) ) ; $ this -> debug ( 'I enter t... | Installs a Extension in Joomla that is located in a url |
58,806 | public function installExtensionFromFileUpload ( $ file , $ type = 'Extension' ) { $ this -> amOnPage ( '/administrator/index.php?option=com_installer' ) ; $ this -> waitForText ( 'Extensions: Install' , '30' , array ( 'css' => 'H1' ) ) ; $ this -> click ( array ( 'link' => 'Upload Package File' ) ) ; $ this -> debug (... | Installs a Extension in Joomla using the file upload option |
58,807 | public function checkForPhpNoticesOrWarnings ( $ page = null ) { if ( $ page ) { $ this -> amOnPage ( $ page ) ; } $ this -> dontSeeInPageSource ( 'Notice:' ) ; $ this -> dontSeeInPageSource ( '<b>Notice</b>:' ) ; $ this -> dontSeeInPageSource ( 'Warning:' ) ; $ this -> dontSeeInPageSource ( '<b>Warning</b>:' ) ; $ thi... | Function to check for PHP Notices or Warnings |
58,808 | public function selectOptionInRadioField ( $ label , $ option ) { $ this -> debug ( "Trying to select the $option from the $label" ) ; $ label = $ this -> findField ( array ( 'xpath' => "//label[contains(normalize-space(string(.)), '$label')]" ) ) ; $ radioId = $ label -> getAttribute ( 'for' ) ; $ this -> click ( "//f... | Selects an option in a Joomla Radio Field based on its label |
58,809 | public function selectOptionInChosen ( $ label , $ option ) { $ select = $ this -> findField ( $ label ) ; $ selectID = $ select -> getAttribute ( 'id' ) ; $ chosenSelectID = $ selectID . '_chzn' ; $ this -> debug ( "I open the $label chosen selector" ) ; $ this -> click ( array ( 'xpath' => "//div[@id='$chosenSelectID... | Selects an option in a Chosen Selector based on its label |
58,810 | public function selectOptionInChosenWithTextField ( $ label , $ option ) { $ select = $ this -> findField ( $ label ) ; $ selectID = $ select -> getAttribute ( 'id' ) ; $ chosenSelectID = $ selectID . '_chzn' ; $ this -> debug ( "I open the $label chosen selector" ) ; $ this -> click ( array ( 'css' => 'div#' . $ chose... | Selects an option in a Chosen Selector based on its label with filling the textfield |
58,811 | public function selectMultipleOptionsInChosen ( $ label , $ options ) { $ select = $ this -> findField ( $ label ) ; $ selectID = $ select -> getAttribute ( 'id' ) ; $ chosenSelectID = $ selectID . '_chzn' ; foreach ( $ options as $ option ) { $ this -> debug ( "I open the $label chosen selector" ) ; $ this -> click ( ... | Selects one or more options in a Chosen Multiple Select based on its label |
58,812 | public function doAdministratorLogout ( ) { $ this -> click ( array ( 'xpath' => "//ul[@class='nav nav-user pull-right']//li//a[@class='dropdown-toggle']" ) ) ; $ this -> debug ( "I click on Top Right corner toggle to Logout from Admin" ) ; $ this -> waitForElement ( array ( 'xpath' => "//li[@class='dropdown open']/ul[... | Function to Logout from Administrator Panel in Joomla! |
58,813 | public function enablePlugin ( $ pluginName ) { $ this -> amOnPage ( '/administrator/index.php?option=com_plugins' ) ; $ this -> debug ( 'I check for Notices and Warnings' ) ; $ this -> checkForPhpNoticesOrWarnings ( ) ; $ this -> searchForItem ( $ pluginName ) ; $ this -> waitForElement ( $ this -> searchResultPluginN... | Function to Enable a Plugin |
58,814 | public function uninstallExtension ( $ extensionName ) { $ this -> amOnPage ( '/administrator/index.php?option=com_installer&view=manage' ) ; $ this -> waitForText ( 'Extensions: Manage' , '30' , array ( 'css' => 'H1' ) ) ; $ this -> searchForItem ( $ extensionName ) ; $ this -> waitForElement ( array ( 'id' => 'manage... | Uninstall Extension based on a name |
58,815 | public function searchForItem ( $ name = null ) { if ( $ name ) { $ this -> debug ( "Searching for $name" ) ; $ this -> fillField ( array ( 'id' => "filter_search" ) , $ name ) ; $ this -> click ( array ( 'xpath' => "//button[@type='submit' and @data-original-title='Search']" ) ) ; return ; } $ this -> debug ( 'clearin... | Function to Search For an Item in Joomla! Administrator Lists views |
58,816 | public function installLanguage ( $ languageName ) { $ this -> amOnPage ( 'administrator/index.php?option=com_installer&view=languages' ) ; $ this -> debug ( 'I check for Notices and Warnings' ) ; $ this -> checkForPhpNoticesOrWarnings ( ) ; $ this -> debug ( 'Refreshing languages' ) ; $ this -> click ( array ( 'xpath'... | Function to install a language through the interface |
58,817 | public function setModulePosition ( $ module , $ position = 'position-7' ) { $ this -> amOnPage ( 'administrator/index.php?option=com_modules' ) ; $ this -> searchForItem ( $ module ) ; $ this -> click ( array ( 'link' => $ module ) ) ; $ this -> waitForText ( "Modules: $module" , 30 , array ( 'css' => 'h1.page-title' ... | Publishes a module on frontend in given position |
58,818 | public function publishModule ( $ module ) { $ this -> amOnPage ( 'administrator/index.php?option=com_modules' ) ; $ this -> searchForItem ( $ module ) ; $ this -> checkAllResults ( ) ; $ this -> click ( array ( 'xpath' => "//div[@id='toolbar-publish']/button" ) ) ; $ this -> waitForText ( ' published.' , 30 , array ( ... | Publishes a module on all frontend pages |
58,819 | public function displayModuleOnAllPages ( $ module ) { $ this -> amOnPage ( 'administrator/index.php?option=com_modules' ) ; $ this -> searchForItem ( $ module ) ; $ this -> click ( array ( 'link' => $ module ) ) ; $ this -> waitForElement ( array ( 'link' => 'Menu Assignment' ) , 30 ) ; $ this -> click ( array ( 'link... | Changes the module Menu assignment to be shown on all the pages of the website |
58,820 | public function clickToolbarButton ( $ button ) { $ input = strtolower ( $ button ) ; $ screenSize = explode ( "x" , $ this -> config [ 'window_size' ] ) ; if ( $ screenSize [ 0 ] <= 480 ) { $ this -> click ( 'Toolbar' ) ; } switch ( $ input ) { case "new" : $ this -> click ( array ( 'xpath' => "//div[@id='toolbar-new'... | Function to select Toolbar buttons in Joomla! Admin Toolbar Panel |
58,821 | public function createMenuItem ( $ menuTitle , $ menuCategory , $ menuItem , $ menu = 'Main Menu' , $ language = 'All' ) { $ this -> debug ( "I open the menus page" ) ; $ this -> amOnPage ( 'administrator/index.php?option=com_menus&view=menus' ) ; $ this -> waitForText ( 'Menus' , TIMEOUT , array ( 'css' => 'H1' ) ) ; ... | Creates a menu item with the Joomla menu manager only working for menu items without additional required fields |
58,822 | public function setFilter ( $ label , $ value ) { $ label = strtolower ( $ label ) ; $ filters = array ( "select status" => "filter_published" , "select access" => "filter_access" , "select language" => "filter_language" , "select tag" => "filter_tag" , "select max levels" => "filter_level" ) ; $ this -> click ( array ... | Function to filter results in Joomla! Administrator . |
58,823 | public function verifyAvailableTabs ( $ expectedTabs , $ tabsLocator = array ( 'xpath' => "//ul[@id='myTabTabs']/li/a" ) ) { $ actualArrayOfTabs = $ this -> grabMultiple ( $ tabsLocator ) ; $ this -> debug ( "Fetch the current list of Tabs in the edit view which is: " . implode ( ", " , $ actualArrayOfTabs ) ) ; $ url ... | Function to Verify the Tabs on a Joomla! screen |
58,824 | public function disableStatistics ( ) { $ this -> debug ( 'I click on never' ) ; $ this -> wait ( 1 ) ; $ this -> waitForElement ( array ( 'link' => 'Never' ) , TIMEOUT ) ; $ this -> click ( array ( 'link' => 'Never' ) ) ; } | Hide the statistics info message |
58,825 | public function createCategory ( $ title , $ extension = '' ) { $ this -> debug ( 'Category creation in /administrator/' ) ; $ this -> doAdministratorLogin ( ) ; if ( ! empty ( $ extension ) ) { $ extension = '&extension=' . $ extension ; } $ this -> amOnPage ( 'administrator/index.php?option=com_categories' . $ extens... | Create a new category |
58,826 | public function createUser ( $ name , $ username , $ password , $ email , $ userGroup = 'Super Users' ) { $ this -> debug ( 'User creation' ) ; $ this -> doAdministratorLogin ( ) ; $ this -> amOnPage ( 'administrator/index.php?option=com_users' ) ; $ this -> waitForElement ( array ( 'class' => 'page-title' ) ) ; $ this... | Create a user in the administrator site |
58,827 | public function table ( $ content , $ options = array ( ) ) { if ( 'text' == $ this -> getType ( ) ) { return $ content ; } if ( false === $ options ) { return $ this -> config ( 'templates.tableend' ) ; } $ tag = 'table' ; if ( is_null ( $ content ) ) { $ tag = 'tablestart' ; } $ templater = $ this -> templater ( ) ; ... | Creates table . |
58,828 | public function viewport ( $ content = null ) { if ( empty ( $ content ) ) { $ content = 'width=device-width, initial-scale=1.0' ; } if ( is_array ( $ content ) ) { $ content = implode ( ', ' , $ content ) ; } return $ this -> meta ( array ( 'name' => 'viewport' , 'content' => $ content ) ) ; } | Viewport meta . |
58,829 | public function deleteCode ( Entity $ userCode ) { $ entityManager = $ this -> entityManager ; $ entityManager -> remove ( $ userCode ) ; $ entityManager -> flush ( ) ; } | delete a userCode from database |
58,830 | private function parse ( \ WP_Query $ query = null ) { ( is_null ( $ query ) && isset ( $ GLOBALS [ 'wp_query' ] ) ) and $ query = $ GLOBALS [ 'wp_query' ] ; $ data = ( object ) [ 'hierarchy' => [ ] , 'templates' => [ ] , 'query' => $ query ] ; $ branches = self :: $ branches ; if ( $ this -> flags & self :: FILTERABLE... | Parse all branches . |
58,831 | public function outputCurrentPlayerImage ( ) { $ playerNumber = $ this -> getCurrentPlayer ( ) ; $ image = imagecreate ( 250 , 50 ) ; $ color = $ this -> collectionOptions -> getGeneralOptions ( ) -> getImagePlayer ( ) [ 'background_color' ] ; imagecolorallocate ( $ image , $ color [ 0 ] , $ color [ 1 ] , $ color [ 2 ]... | output the player online image |
58,832 | public function delete ( ) { $ query = $ this -> createQuery ( ) ; $ query -> setAction ( 'delete' ) ; $ query -> where ( $ query -> buildAndSet ( [ $ this -> getTableKey ( ) , '=' , $ this -> id ] ) ) ; $ result = $ this -> database -> query ( $ query ) ; return $ result ? true : false ; } | Deletes the current model from the database . |
58,833 | public function populate ( array $ data ) { foreach ( $ data as $ property => $ value ) { if ( property_exists ( $ this , $ property ) ) { $ this -> { $ property } = $ value ; } } return $ this ; } | Populates the current model with the data provided . |
58,834 | public function toArray ( $ keepNullValue = false ) { $ reflection = new \ ReflectionClass ( static :: class ) ; $ arrayData = [ ] ; foreach ( $ reflection -> getProperties ( \ ReflectionProperty :: IS_PUBLIC ) as $ property ) { $ value = $ property -> getValue ( $ this ) ; if ( $ property -> isStatic ( ) ) { continue ... | Generates an array of the current model without the protected values . |
58,835 | public function toArrayWithoutEmptyValues ( ) { $ array = $ this -> removeEmptyValues ( $ this -> toArray ( true ) ) ; foreach ( $ array as $ key => $ value ) { if ( $ value === \ Parable \ ORM \ Database :: NULL_VALUE ) { $ array [ $ key ] = null ; } } return $ array ; } | Generates an array of the current model but removes empty values . |
58,836 | public function toMappedArray ( array $ array ) { $ mappedArray = [ ] ; foreach ( $ this -> getMapper ( ) as $ from => $ to ) { $ mappedArray [ $ to ] = $ array [ $ from ] ; } return $ mappedArray ; } | Attempts to use stored mapper array to map fields from the current model s properties to what is set in the array . |
58,837 | public function exportToArray ( ) { $ data = $ this -> toArray ( ) ; if ( count ( $ this -> exportable ) === 0 ) { return $ data ; } $ exportData = [ ] ; foreach ( $ data as $ key => $ value ) { if ( in_array ( $ key , $ this -> exportable ) ) { $ exportData [ $ key ] = $ data [ $ key ] ; } } return $ exportData ; } | Export to array which will exclude unexportable keys |
58,838 | public function reset ( ) { $ reflection = new \ ReflectionClass ( static :: class ) ; foreach ( $ reflection -> getProperties ( \ ReflectionProperty :: IS_PUBLIC ) as $ property ) { if ( ! $ property -> isStatic ( ) ) { $ this -> { $ property -> getName ( ) } = null ; } } return $ this ; } | Reset all public properties to null . |
58,839 | public function setRequired ( $ required ) { if ( ! in_array ( $ required , [ \ Parable \ Console \ Parameter :: PARAMETER_REQUIRED , \ Parable \ Console \ Parameter :: PARAMETER_OPTIONAL , ] ) ) { throw new \ Parable \ Console \ Exception ( 'Required must be one of the PARAMETER_* constants.' ) ; } $ this -> required ... | Set whether this argument is required . |
58,840 | public function init ( ) { parent :: init ( ) ; self :: $ plugin = $ this ; Craft :: $ app -> getView ( ) -> registerTwigExtension ( new EnvironmentLabelTwigExtension ( ) ) ; Event :: on ( View :: class , View :: EVENT_BEFORE_RENDER_PAGE_TEMPLATE , function ( Event $ event ) { EnvironmentLabel :: $ plugin -> label -> d... | Initializes the plugin sets its static self - reference registers the Twig extension and adds the environment label as appropriate . |
58,841 | public function send ( $ to , $ subject , $ body , $ headers ) { return mail ( $ to , $ subject , $ body , $ headers ) ; } | Send using PHPs built - in Mail interface |
58,842 | protected function loadCommands ( PackageInterface $ package ) { if ( ! $ package -> getCommands ( ) || APP_CONTEXT !== 'console' ) { return $ this ; } $ commandLoader = \ Parable \ DI \ Container :: create ( \ Parable \ Framework \ Loader \ CommandLoader :: class ) ; $ commandLoader -> load ( $ package -> getCommands ... | Load all Commands from package . |
58,843 | public function registerPackages ( ) { foreach ( $ this -> packages as $ packageName ) { $ package = \ Parable \ DI \ Container :: create ( $ packageName ) ; $ this -> loadCommands ( $ package ) ; $ this -> loadInits ( $ package ) ; } return $ this ; } | Register all packages with Parable . |
58,844 | protected function loadInits ( PackageInterface $ package ) { if ( ! $ package -> getInits ( ) ) { return $ this ; } $ initLoader = \ Parable \ DI \ Container :: create ( \ Parable \ Framework \ Loader \ InitLoader :: class ) ; $ initLoader -> load ( $ package -> getInits ( ) ) ; return $ this ; } | Load all Inits from package . |
58,845 | public function load ( array $ commandClasses ) { foreach ( $ commandClasses as $ commandClass ) { $ command = \ Parable \ DI \ Container :: create ( $ commandClass ) ; $ this -> consoleApp -> addCommand ( $ command ) ; } return $ this ; } | Add all commands passed to the console app . |
58,846 | public function addCommand ( \ Parable \ Console \ Command $ command ) { $ command -> prepare ( $ this , $ this -> output , $ this -> input , $ this -> parameter ) ; $ this -> commands [ $ command -> getName ( ) ] = $ command ; return $ this ; } | Add a command to the application . |
58,847 | public function setDefaultCommand ( \ Parable \ Console \ Command $ command ) { $ this -> addCommand ( $ command ) ; $ this -> setDefaultCommandByName ( $ command -> getName ( ) ) ; return $ this ; } | Set the default command to use if no command is given . Also adds the command . |
58,848 | public function getOrder ( ) { $ request = $ this -> getRequestHandler ( ) ; $ listener = new PayPalListener ( $ request ) ; $ listener -> setMode ( $ this -> getEnvironment ( ) ) ; if ( $ listener -> verifyIpn ( ) ) { return $ this -> store ( $ request -> getData ( ) ) ; } else { throw new InvalidIpnException ( "PayPa... | Listens for and stores PayPal IPN requests . |
58,849 | public function getRequestHandler ( ) { $ config = Config :: get ( 'paypal-ipn-laravel::request_handler' , 'auto' ) ; if ( $ config == 'curl' || ( $ config == 'auto' && is_callable ( 'curl_init' ) ) ) { return new CurlRequest ( Input :: all ( ) ) ; } else { return new SocketRequest ( Input :: all ( ) ) ; } } | Get the request handler . |
58,850 | private function store ( $ data ) { if ( array_key_exists ( 'txn_id' , $ data ) ) { $ order = IpnOrder :: firstOrNew ( array ( 'txn_id' => $ data [ 'txn_id' ] ) ) ; $ order -> fill ( $ data ) ; } else { $ order = new IpnOrder ( $ data ) ; } $ order -> full_ipn = json_encode ( Input :: all ( ) ) ; $ order -> save ( ) ; ... | Stores the IPN contents and returns the IpnOrder object . |
58,851 | private function storeOrderItems ( $ order , $ data ) { $ cart = isset ( $ data [ 'num_cart_items' ] ) ; $ numItems = ( isset ( $ data [ 'num_cart_items' ] ) ) ? $ data [ 'num_cart_items' ] : 1 ; for ( $ i = 0 ; $ i < $ numItems ; $ i ++ ) { $ suffix = ( $ numItems > 1 || $ cart ) ? ( $ i + 1 ) : '' ; $ suffixUnderscor... | Stores the order items from the IPN contents . |
58,852 | public function add ( $ cacheKey , $ content , $ status = 200 , $ headers = [ ] , $ expires = Cache :: HOUR ) { $ file = File :: create ( ) ; $ file -> setStatus ( $ status ) ; $ file -> setContent ( $ content ) ; $ file -> setRoute ( $ cacheKey ) ; $ file -> setHeaders ( $ headers ) ; if ( $ expires > 0 ) { $ file -> ... | Adds a cache entry with a given key content and for a set amount of time The time by default for the cache is an hour |
58,853 | public function setShouldCompareFields ( $ shouldCompareFields ) { $ this -> shouldQuoteValues = ! $ shouldCompareFields ; $ this -> shouldCompareFields = ( bool ) $ shouldCompareFields ; return $ this ; } | Set whether the fields should be compared rather than values . If so quoteValues is set to inverted value . |
58,854 | public function build ( ) { $ value = $ this -> getValue ( ) ; $ this -> uppercaseComparator ( ) ; if ( $ this -> isComparatorIsNotNullIsNull ( ) ) { $ value = null ; } if ( ! $ this -> isComparatorIsNotNullIsNull ( ) && $ this -> isComparatorInNotIn ( ) && is_array ( $ value ) ) { $ this -> uppercaseComparator ( ) ; $... | Build the condition to a string . |
58,855 | public function load ( array $ initClasses ) { foreach ( $ initClasses as $ initClass ) { \ Parable \ DI \ Container :: create ( $ initClass ) ; } return $ this ; } | Load array of init classes . |
58,856 | public function doAuthentication ( UserInterface $ user ) { $ repository = $ this -> entityManager -> getRepository ( $ this -> getUserEntityClassName ( ) ) ; $ username = $ user -> getUsername ( ) ; $ repository -> clear ( ) ; $ userNew = $ repository -> getUser4UserName ( $ username ) ; $ authService = $ this -> getA... | Login with a User |
58,857 | protected function bCrypt ( $ password ) { if ( $ this -> isSamePasswordOption ( ) ) { $ result = $ this -> gameDataService -> hashPassword ( $ password ) ; } else { $ bCrypt = new Bcrypt ( ) ; $ result = $ bCrypt -> create ( $ password ) ; } return $ result ; } | We want to crypt a password = ) |
58,858 | public static function get ( $ className , $ parentClassName = '' ) { $ className = self :: cleanName ( $ className ) ; if ( $ parentClassName ) { self :: $ relations [ $ className ] [ $ parentClassName ] = true ; } if ( $ parentClassName && isset ( self :: $ relations [ $ parentClassName ] ) && isset ( self :: $ relat... | Return an already instantiated instance or create a new one . |
58,859 | protected static function createInstance ( $ className , $ parentClassName = '' , $ createAll = false ) { $ className = self :: cleanName ( $ className ) ; try { $ dependencies = self :: getDependenciesFor ( $ className , $ createAll ) ; } catch ( \ Parable \ DI \ Exception $ e ) { $ message = $ e -> getMessage ( ) ; i... | Instantiate a class and fulfill its dependency requirements . |
58,860 | public static function clearExcept ( array $ keepInstanceNames ) { foreach ( self :: $ instances as $ name => $ instance ) { if ( ! in_array ( $ name , $ keepInstanceNames ) ) { self :: clear ( $ name ) ; } } } | Remove all stored instances but KEEP the passed instance names . |
58,861 | public function discardUpperMigrations ( Bundle $ bundle ) { $ drivers = array_keys ( $ this -> getAvailablePlatforms ( ) ) ; $ currentVersion = $ this -> migrator -> getCurrentVersion ( $ bundle ) ; $ this -> log ( "Deleting migration classes above version {$currentVersion} for '{$bundle->getName()}'..." ) ; $ hasDele... | Deletes migration classes which are above the current version of a bundle . |
58,862 | public function getAvailablePlatforms ( ) { $ platforms = array ( ) ; foreach ( $ this -> getSupportedDrivers ( ) as $ driverName => $ driverClass ) { $ driver = new $ driverClass ; $ platforms [ $ driverName ] = $ driver -> getDatabasePlatform ( ) ; } return $ platforms ; } | Returns the list of available driver platforms . |
58,863 | public function getHeader ( $ key ) { foreach ( $ this -> headers as $ header => $ content ) { if ( strtolower ( $ key ) === strtolower ( $ header ) ) { return $ content ; } } return null ; } | Return header by key if it exists . |
58,864 | public function getScheme ( ) { if ( isset ( $ _SERVER [ 'REQUEST_SCHEME' ] ) ) { return $ _SERVER [ 'REQUEST_SCHEME' ] ; } if ( isset ( $ _SERVER [ 'REDIRECT_REQUEST_SCHEME' ] ) ) { return $ _SERVER [ 'REDIRECT_REQUEST_SCHEME' ] ; } if ( isset ( $ _SERVER [ 'HTTP_X_FORWARDED_PROTO' ] ) ) { return $ _SERVER [ 'HTTP_X_F... | Return the current scheme . |
58,865 | public function getHttpHost ( ) { if ( isset ( $ _SERVER [ 'HTTP_HOST' ] ) && isset ( $ _SERVER [ 'SERVER_NAME' ] ) && $ _SERVER [ 'HTTP_HOST' ] === $ _SERVER [ 'SERVER_NAME' ] ) { return $ _SERVER [ 'HTTP_HOST' ] ; } if ( isset ( $ _SERVER [ 'HTTP_HOST' ] ) ) { return $ _SERVER [ 'HTTP_HOST' ] ; } if ( isset ( $ _SERV... | Return the http host if possible . |
58,866 | public function getAll ( ) { if ( ! $ this -> getResource ( ) ) { return [ ] ; } if ( $ this -> useLocalResource ) { return $ this -> localResource ; } if ( ! isset ( $ GLOBALS [ $ this -> getResource ( ) ] ) ) { throw new \ Parable \ GetSet \ Exception ( "Attempting to use global resource '{$this->getResource()}' but ... | Return all from resource if resource is set . |
58,867 | public function get ( $ key , $ default = null ) { $ resource = $ this -> getAll ( ) ; $ keys = explode ( '.' , $ key ) ; foreach ( $ keys as $ key ) { if ( ! isset ( $ resource [ $ key ] ) ) { $ resource = $ default ; break ; } $ resource = & $ resource [ $ key ] ; } return $ resource ; } | Return specific value by key if resource set . If not found return default . |
58,868 | public function getAndRemove ( $ key ) { $ data = $ this -> get ( $ key ) ; if ( $ data ) { $ this -> remove ( $ key ) ; } return $ data ; } | Return specific value by key and then clear it . |
58,869 | public function set ( $ key , $ value ) { $ keys = explode ( '.' , $ key ) ; $ data = $ this -> getAll ( ) ; $ resource = & $ data ; foreach ( $ keys as $ key ) { if ( ! isset ( $ resource [ $ key ] ) || ! is_array ( $ resource [ $ key ] ) ) { $ resource [ $ key ] = [ ] ; } $ resource = & $ resource [ $ key ] ; } $ res... | Set specific value by key if resource set . It s possible to set using . to separate keys by depth . |
58,870 | public function setAll ( array $ values ) { if ( $ this -> getResource ( ) ) { if ( $ this -> useLocalResource ) { $ this -> localResource = $ values ; } else { $ GLOBALS [ $ this -> getResource ( ) ] = $ values ; } } return $ this ; } | Set entire array onto the resource |
58,871 | public function checkCodestyle ( $ sniffersPath = null ) { if ( is_null ( $ sniffersPath ) ) { $ sniffersPath = __DIR__ . '/.tmp/coding-standards' ; } $ this -> taskCodeChecks ( ) -> setBaseRepositoryPath ( __DIR__ ) -> setCodeStyleStandardsFolder ( $ sniffersPath ) -> setCodeStyleCheckFolders ( array ( 'src' ) ) -> ch... | Check the code style of the project against a passed sniffers using PHP_CodeSniffer_CLI |
58,872 | public function closeTag ( ) { $ result = '</label>' ; if ( $ this -> element -> hasAttribute ( 'required' ) && $ this -> element -> getAttribute ( 'required' ) ) { $ result = sprintf ( '<span class="required-mark">*</span> %s' , $ result ) ; } return $ result ; } | Return a closing label tag |
58,873 | public function doItBaby ( ) { if ( EnvironmentLabel :: $ plugin -> getSettings ( ) -> showLabel && Craft :: $ app -> getRequest ( ) -> isCpRequest && Craft :: $ app -> getUser ( ) -> getIdentity ( ) ) { $ view = Craft :: $ app -> getView ( ) ; $ view -> registerCss ( $ this -> getCss ( ) ) ; $ view -> registerCss ( "{... | If we re in an authenticated CP request the label is added to the CP and some JS variables are injected for convenience debugging things in the console . |
58,874 | public function init ( array $ frontendData ) : void { $ this -> _frontendData = Hash :: merge ( $ this -> _frontendData , $ frontendData ) ; $ this -> _includeAppController ( ) ; $ this -> _includeComponents ( ) ; } | Initialize the helper . Needs to be called before running it . |
58,875 | public static function getAssetCompressFiles ( ) : array { $ helper = new FrontendBridgeHelper ( new View ( ) ) ; $ dependencies = $ helper -> compileDependencies ( ) ; $ plugins = array_map ( '\Cake\Utility\Inflector::underscore' , Plugin :: loaded ( ) ) ; foreach ( $ dependencies as $ n => $ dependency ) { $ parts = ... | Compiles an AssetCompress - compatible list of assets to be used in asset_compress . ini files as a callback method |
58,876 | public function subControllerElement ( array $ url , array $ data = [ ] , array $ options = [ ] ) : string { $ options = Hash :: merge ( [ 'htmlElement' => 'div' ] , $ options ) ; $ name = '../' . $ url [ 'controller' ] . '/' . Inflector :: underscore ( $ url [ 'action' ] ) ; $ markup = '<' . $ options [ 'htmlElement' ... | Renders a subcontroller element which gets an js controller instance assigned |
58,877 | public function getMainContentClasses ( array $ additionalClasses = null ) : string { $ classes = [ 'controller' ] ; if ( ! empty ( $ additionalClasses ) ) { $ classes = Hash :: merge ( $ classes , $ additionalClasses ) ; } $ classes [ ] = Inflector :: underscore ( $ this -> _View -> request -> controller ) . '-' . Inf... | Constructs the classes for the element that represents the frontend controller s DOM reference . |
58,878 | public function run ( ) : string { $ out = '' ; $ this -> _dependencies = array_unique ( $ this -> _dependencies ) ; $ out .= $ this -> getNamespaceDefinitions ( ) ; $ this -> addCurrentController ( ) ; foreach ( $ this -> _dependencies as $ dependency ) { if ( strpos ( $ dependency , DS ) !== false ) { $ dependency = ... | Includes the configured JS dependencies and appData - should be called from the layout |
58,879 | public function getNamespaceDefinitions ( ) : string { $ script = 'var Frontend = {};' ; $ script .= 'var App = { Controllers: {}, Components: {}, Lib: {} };' ; $ tpl = 'App.Controllers.%s = {};' ; foreach ( $ this -> _pluginJsNamespaces as $ pluginName ) { $ script .= sprintf ( $ tpl , $ pluginName ) ; } return $ this... | Returns a script block containing namespace definitions for plugin controllers . |
58,880 | public function addComponent ( $ componentName ) : bool { if ( is_array ( $ componentName ) ) { foreach ( $ componentName as $ cn ) { $ this -> addComponent ( $ cn ) ; } return true ; } $ componentFile = 'app/components/' . Inflector :: underscore ( $ componentName ) . '.js' ; if ( file_exists ( JS . DS . $ componentFi... | Include one or more JS components |
58,881 | public function setFrontendData ( $ key , $ value = null ) : void { if ( is_array ( $ key ) ) { foreach ( $ key as $ k => $ v ) { $ this -> setFrontendData ( $ k , $ v ) ; } return ; } $ this -> _frontendData [ 'jsonData' ] [ $ key ] = $ value ; } | Allows manipulating frontend data |
58,882 | public function dialogBackButton ( string $ title = null ) : string { $ button = '<button class="modal-back btn btn-default btn-xs">' ; $ button .= '<i class="fa fa-fw fa-arrow-left"></i>' ; $ button .= $ title ?? __ ( 'back' ) ; $ button .= '</button>' ; return $ button ; } | Get the back button for modal dialogs if dialog_header is not used |
58,883 | protected function _addDependency ( string $ file ) : void { $ file = str_replace ( '\\' , '/' , $ file ) ; if ( ! in_array ( $ file , $ this -> _dependencies ) ) { $ this -> _dependencies [ ] = $ file ; } } | Add a file to the frontend dependencies |
58,884 | protected function _includeAppController ( ) : void { $ controller = null ; if ( file_exists ( WWW_ROOT . 'js/app/app_controller.js' ) ) { $ controller = 'app/app_controller.js' ; } else { $ controller = '/frontend_bridge/js/lib/app_controller.js' ; } $ this -> _dependencies [ ] = $ controller ; } | Check if we have an AppController if not include a stub |
58,885 | protected function _includeComponents ( ) : void { $ appComponentFolder = WWW_ROOT . 'js/app/components/' ; $ folder = new Folder ( $ appComponentFolder ) ; $ files = $ folder -> find ( '.*\.js' ) ; if ( ! empty ( $ files ) ) { foreach ( $ files as $ file ) { $ this -> _dependencies [ ] = 'app/components/' . $ file ; }... | Includes the needed components |
58,886 | public function setDataFromArray ( array $ data ) { foreach ( $ data as $ property => $ value ) { $ method = 'set' . ucfirst ( $ property ) ; if ( method_exists ( $ this , $ method ) ) { $ this -> { $ method } ( $ value ) ; } else { throw new \ Parable \ Routing \ Exception ( "Tried to set non-existing property '{$prop... | Set data from array . Can only set values that have a corresponding setProperty method . |
58,887 | public function setUrl ( $ url ) { if ( strpos ( $ url , '/' ) !== 0 ) { $ url = '/' . $ url ; } $ this -> url = $ url ; return $ this ; } | Set the url this route is matched on . |
58,888 | public function checkValidProperties ( ) { if ( ! $ this -> controller && ! $ this -> action && ! $ this -> callable ) { throw new \ Parable \ Routing \ Exception ( 'Either a controller/action combination or callable is required.' ) ; } if ( empty ( $ this -> methods ) ) { throw new \ Parable \ Routing \ Exception ( 'M... | Check whether a valid set of properties is set . |
58,889 | public function isPartCountSame ( $ url ) { return count ( explode ( '/' , rtrim ( $ url , '/' ) ) ) === count ( explode ( '/' , rtrim ( $ this -> url , '/' ) ) ) ; } | Verify whether this route s url has the same part count . |
58,890 | public function getValue ( $ key ) { if ( ! isset ( $ this -> values [ $ key ] ) ) { return null ; } return $ this -> values [ $ key ] ; } | Return a value if it exists . |
58,891 | protected function extractAndSetData ( $ data ) { $ data_parsed = json_decode ( $ data , true ) ; if ( json_last_error ( ) !== JSON_ERROR_NONE ) { parse_str ( $ data , $ data_parsed ) ; } if ( is_array ( $ data_parsed ) ) { $ this -> setAll ( $ data_parsed ) ; } } | Attempt to get the data from a string which can be either json or array data . |
58,892 | protected function build ( $ withParentheses ) { $ builtConditions = [ ] ; foreach ( $ this -> conditions as $ condition ) { if ( $ condition instanceof \ Parable \ ORM \ Query \ ConditionSet ) { $ builtConditions [ ] = $ condition -> buildWithParentheses ( ) ; } else { $ builtConditions [ ] = $ condition -> build ( ) ... | Build the conditions into a string . Can be done either with parentheses or without . |
58,893 | public function bake ( $ controllerName , $ actionName , $ content = '' ) { if ( $ content === true ) { $ content = $ this -> getContent ( $ action ) ; } if ( empty ( $ content ) ) { return false ; } $ this -> out ( "\n" . sprintf ( 'Baking `%s%s/%s` JS controller file...' , ( $ this -> plugin ? $ this -> plugin . '.' ... | Bakes the JS file |
58,894 | public function write ( $ message ) { if ( ! $ this -> logFile ) { throw new \ Parable \ Log \ Exception ( "No log file set. \Log\Writer\File requires a valid target file." ) ; } $ this -> writeToFile ( $ message ) ; return $ this ; } | Write a message to the log file configured . |
58,895 | public function setLogFile ( $ logFile ) { if ( ! $ this -> createfile ( $ logFile ) ) { throw new \ Parable \ Log \ Exception ( "Log file is not writable." ) ; } $ this -> logFile = $ logFile ; return $ this ; } | Set the log file to write to . |
58,896 | protected function writeToFile ( $ message ) { $ message = $ message . PHP_EOL ; return @ file_put_contents ( $ this -> logFile , $ message , FILE_APPEND ) ; } | Write the message to the log file . |
58,897 | public function setErrorMode ( $ errorMode ) { if ( in_array ( $ errorMode , [ \ PDO :: ERRMODE_SILENT , \ PDO :: ERRMODE_WARNING , \ PDO :: ERRMODE_EXCEPTION ] ) ) { $ this -> errorMode = $ errorMode ; } return $ this ; } | Set the error mode . |
58,898 | public function getInstance ( ) { if ( ! $ this -> instance && $ this -> getType ( ) && $ this -> getLocation ( ) ) { switch ( $ this -> getType ( ) ) { case static :: TYPE_SQLITE : $ instance = $ this -> createPDOSQLite ( $ this -> getLocation ( ) , $ this -> getErrorMode ( ) ) ; $ this -> setInstance ( $ instance ) ;... | Return the instance and start one if needed . |
58,899 | protected function createPDOSQLite ( $ location , $ errorMode ) { $ dsn = 'sqlite:' . $ location ; $ db = new \ Parable \ ORM \ Database \ PDOSQLite ( $ dsn ) ; $ db -> setAttribute ( \ PDO :: ATTR_ERRMODE , $ errorMode ) ; return $ db ; } | Create and return a sqlite PDO instance . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.