├── .DS_Store ├── .gitignore ├── LICENSE ├── Lib ├── .DS_Store ├── analog │ └── analog │ │ ├── .gitignore │ │ ├── .travis.yml │ │ ├── LICENSE │ │ ├── README.md │ │ ├── composer.json │ │ ├── examples │ │ ├── SplClassLoader.php │ │ ├── amon.php │ │ ├── buffer.php │ │ ├── chromelogger.php │ │ ├── default.php │ │ ├── file.php │ │ ├── firephp.php │ │ ├── gelf.php │ │ ├── ignore.php │ │ ├── levelbuffer.php │ │ ├── mail.php │ │ ├── mongo.php │ │ ├── multi.php │ │ ├── post.php │ │ ├── psr-0.php │ │ ├── server.php │ │ ├── stderr.php │ │ ├── syslog.php │ │ ├── threshold.php │ │ └── variable.php │ │ ├── lib │ │ ├── Analog.php │ │ ├── Analog │ │ │ ├── Analog.php │ │ │ ├── Handler │ │ │ │ ├── Amon.php │ │ │ │ ├── Buffer.php │ │ │ │ ├── Buffer │ │ │ │ │ └── Destructor.php │ │ │ │ ├── ChromeLogger.php │ │ │ │ ├── File.php │ │ │ │ ├── FirePHP.php │ │ │ │ ├── GELF.php │ │ │ │ ├── Ignore.php │ │ │ │ ├── LevelBuffer.php │ │ │ │ ├── LevelName.php │ │ │ │ ├── Mail.php │ │ │ │ ├── Mongo.php │ │ │ │ ├── Multi.php │ │ │ │ ├── Null.php │ │ │ │ ├── Post.php │ │ │ │ ├── Stderr.php │ │ │ │ ├── Syslog.php │ │ │ │ ├── Threshold.php │ │ │ │ ├── Variable.php │ │ │ │ └── WPMail.php │ │ │ └── Logger.php │ │ └── ChromePhp.php │ │ ├── phpunit.xml.dist │ │ └── tests │ │ ├── AnalogTest.php │ │ ├── PsrLogCompatTest.php │ │ └── bootstrap.php ├── autoload.php ├── composer │ ├── ClassLoader.php │ ├── LICENSE │ ├── autoload_classmap.php │ ├── autoload_files.php │ ├── autoload_namespaces.php │ ├── autoload_psr4.php │ ├── autoload_real.php │ ├── autoload_static.php │ └── installed.json ├── danielstjules │ └── stringy │ │ ├── CHANGELOG.md │ │ ├── LICENSE.txt │ │ ├── README.md │ │ ├── composer.json │ │ └── src │ │ ├── Create.php │ │ ├── StaticStringy.php │ │ └── Stringy.php ├── ivome │ ├── .DS_Store │ └── graphql-relay-php │ │ ├── .gitignore │ │ ├── .travis.yml │ │ ├── README.md │ │ ├── composer.json │ │ ├── contributors.txt │ │ ├── phpunit.xml │ │ ├── src │ │ ├── Connection │ │ │ ├── ArrayConnection.php │ │ │ └── Connection.php │ │ ├── Mutation │ │ │ └── Mutation.php │ │ ├── Node │ │ │ ├── Node.php │ │ │ └── Plural.php │ │ └── Relay.php │ │ └── tests │ │ ├── Connection │ │ ├── ArrayConnectionTest.php │ │ └── ConnectionTest.php │ │ ├── Mutation │ │ └── MutationTest.php │ │ ├── Node │ │ ├── NodeTest.php │ │ └── PluralTest.php │ │ ├── RelayTest.php │ │ ├── StarWarsConnectionTest.php │ │ ├── StarWarsData.php │ │ ├── StarWarsMutationTest.php │ │ ├── StarWarsObjectIdentificationTest.php │ │ └── StarWarsSchema.php ├── mohiohio │ ├── .DS_Store │ └── wordpress-lib │ │ ├── .DS_Store │ │ ├── LICENSE │ │ ├── composer.json │ │ └── src │ │ ├── Admin.php │ │ ├── CustomPostType.php │ │ ├── CustomTaxonomy.php │ │ ├── Import.php │ │ ├── QuickConfig.php │ │ ├── Router.php │ │ ├── Setting │ │ ├── Field.php │ │ ├── Page.php │ │ └── Section.php │ │ └── WordPress.php ├── psr │ └── log │ │ ├── .gitignore │ │ ├── LICENSE │ │ ├── Psr │ │ └── Log │ │ │ ├── AbstractLogger.php │ │ │ ├── InvalidArgumentException.php │ │ │ ├── LogLevel.php │ │ │ ├── LoggerAwareInterface.php │ │ │ ├── LoggerAwareTrait.php │ │ │ ├── LoggerInterface.php │ │ │ ├── LoggerTrait.php │ │ │ ├── NullLogger.php │ │ │ └── Test │ │ │ └── LoggerInterfaceTest.php │ │ ├── README.md │ │ └── composer.json ├── symfony │ ├── .DS_Store │ └── polyfill-mbstring │ │ ├── LICENSE │ │ ├── Mbstring.php │ │ ├── README.md │ │ ├── Resources │ │ └── unidata │ │ │ ├── lowerCase.php │ │ │ └── upperCase.php │ │ ├── bootstrap.php │ │ └── composer.json └── webonyx │ ├── .DS_Store │ └── graphql-php │ ├── .gitignore │ ├── .travis.yml │ ├── LICENSE │ ├── README.md │ ├── composer.json │ ├── phpunit.xml.dist │ ├── src │ ├── Error.php │ ├── Executor │ │ ├── DeprecatedMappingExecutor.php │ │ ├── ExecutionContext.php │ │ ├── ExecutionResult.php │ │ ├── Executor.php │ │ └── Values.php │ ├── FormattedError.php │ ├── GraphQL.php │ ├── Language │ │ ├── AST │ │ │ ├── Argument.php │ │ │ ├── BooleanValue.php │ │ │ ├── Definition.php │ │ │ ├── Directive.php │ │ │ ├── Document.php │ │ │ ├── EnumValue.php │ │ │ ├── Field.php │ │ │ ├── FloatValue.php │ │ │ ├── FragmentDefinition.php │ │ │ ├── FragmentSpread.php │ │ │ ├── InlineFragment.php │ │ │ ├── IntValue.php │ │ │ ├── ListType.php │ │ │ ├── ListValue.php │ │ │ ├── Location.php │ │ │ ├── Name.php │ │ │ ├── NamedType.php │ │ │ ├── Node.php │ │ │ ├── NonNullType.php │ │ │ ├── ObjectField.php │ │ │ ├── ObjectValue.php │ │ │ ├── OperationDefinition.php │ │ │ ├── Selection.php │ │ │ ├── SelectionSet.php │ │ │ ├── StringValue.php │ │ │ ├── Type.php │ │ │ ├── Value.php │ │ │ ├── Variable.php │ │ │ └── VariableDefinition.php │ │ ├── Lexer.php │ │ ├── Parser.php │ │ ├── Printer.php │ │ ├── Source.php │ │ ├── SourceLocation.php │ │ ├── Token.php │ │ └── Visitor.php │ ├── Schema.php │ ├── SyntaxError.php │ ├── Type │ │ ├── Definition │ │ │ ├── AbstractType.php │ │ │ ├── BooleanType.php │ │ │ ├── CompositeType.php │ │ │ ├── Config.php │ │ │ ├── Directive.php │ │ │ ├── EnumType.php │ │ │ ├── EnumValueDefinition.php │ │ │ ├── FieldArgument.php │ │ │ ├── FieldDefinition.php │ │ │ ├── FloatType.php │ │ │ ├── IDType.php │ │ │ ├── InputObjectField.php │ │ │ ├── InputObjectType.php │ │ │ ├── InputType.php │ │ │ ├── IntType.php │ │ │ ├── InterfaceType.php │ │ │ ├── LeafType.php │ │ │ ├── ListOfType.php │ │ │ ├── NonNull.php │ │ │ ├── ObjectType.php │ │ │ ├── OutputType.php │ │ │ ├── ResolveInfo.php │ │ │ ├── ScalarType.php │ │ │ ├── StringType.php │ │ │ ├── Type.php │ │ │ ├── UnionType.php │ │ │ ├── UnmodifiedType.php │ │ │ └── WrappingType.php │ │ ├── Introspection.php │ │ └── SchemaValidator.php │ ├── Utils.php │ ├── Utils │ │ ├── PairSet.php │ │ └── TypeInfo.php │ └── Validator │ │ ├── DocumentValidator.php │ │ ├── Messages.php │ │ ├── Rules │ │ ├── AbstractQuerySecurity.php │ │ ├── ArgumentsOfCorrectType.php │ │ ├── DefaultValuesOfCorrectType.php │ │ ├── FieldsOnCorrectType.php │ │ ├── FragmentsOnCompositeTypes.php │ │ ├── KnownArgumentNames.php │ │ ├── KnownDirectives.php │ │ ├── KnownFragmentNames.php │ │ ├── KnownTypeNames.php │ │ ├── NoFragmentCycles.php │ │ ├── NoUndefinedVariables.php │ │ ├── NoUnusedFragments.php │ │ ├── NoUnusedVariables.php │ │ ├── OverlappingFieldsCanBeMerged.php │ │ ├── PossibleFragmentSpreads.php │ │ ├── ProvidedNonNullArguments.php │ │ ├── QueryComplexity.php │ │ ├── QueryDepth.php │ │ ├── ScalarLeafs.php │ │ ├── VariablesAreInputTypes.php │ │ └── VariablesInAllowedPosition.php │ │ └── ValidationContext.php │ └── tests │ ├── Executor │ ├── AbstractTest.php │ ├── DirectivesTest.php │ ├── ExecutionResultTest.php │ ├── ExecutorSchemaTest.php │ ├── ExecutorTest.php │ ├── ListsTest.php │ ├── MutationsTest.php │ ├── NonNullTest.php │ ├── TestClasses.php │ ├── UnionInterfaceTest.php │ └── VariablesTest.php │ ├── Language │ ├── LexerTest.php │ ├── ParserTest.php │ ├── PrinterTest.php │ ├── VisitorTest.php │ └── kitchen-sink.graphql │ ├── StarWarsData.php │ ├── StarWarsIntrospectionTest.php │ ├── StarWarsQueryTest.php │ ├── StarWarsSchema.php │ ├── StarWarsValidationTest.php │ ├── Type │ ├── DefinitionTest.php │ ├── IntrospectionTest.php │ ├── ResolveInfoTest.php │ ├── ScalarSerializationTest.php │ └── SchemaValidatorTest.php │ └── Validator │ ├── AbstractQuerySecurityTest.php │ ├── ArgumentsOfCorrectTypeTest.php │ ├── DefaultValuesOfCorrectTypeTest.php │ ├── FieldsOnCorrectTypeTest.php │ ├── FragmentsOnCompositeTypesTest.php │ ├── KnownArgumentNamesTest.php │ ├── KnownDirectivesTest.php │ ├── KnownFragmentNamesTest.php │ ├── KnownTypeNamesTest.php │ ├── NoFragmentCyclesTest.php │ ├── NoUndefinedVariablesTest.php │ ├── NoUnusedFragmentsTest.php │ ├── NoUnusedVariablesTest.php │ ├── OverlappingFieldsCanBeMergedTest.php │ ├── PossibleFragmentSpreadsTest.php │ ├── ProvidedNonNullArgumentsTest.php │ ├── QueryComplexityTest.php │ ├── QueryDepthTest.php │ ├── QuerySecuritySchema.php │ ├── ScalarLeafsTest.php │ ├── TestCase.php │ ├── VariablesAreInputTypesTest.php │ └── VariablesInAllowedPositionTest.php ├── README.md ├── Schema.php ├── Type └── Definition │ ├── Attachment.php │ ├── Author.php │ ├── BlogInfo.php │ ├── Category.php │ ├── Comment.php │ ├── HeaderVideo.php │ ├── ImageSrc.php │ ├── MenuItem.php │ ├── Page.php │ ├── Post.php │ ├── PostFormat.php │ ├── PostStatus.php │ ├── PostType.php │ ├── Query.php │ ├── Tag.php │ ├── WPInterfaceType.php │ ├── WPObjectType.php │ ├── WPPost.php │ ├── WPQuery.php │ ├── WPSchema.php │ └── WPTerm.php ├── composer.json ├── composer.lock └── index.php /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whuysmans/vuewp-graphql/1aafede5db8b75a7f2f9ad3102b2758dc4579231/.DS_Store -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /vendor/ 2 | -------------------------------------------------------------------------------- /Lib/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whuysmans/vuewp-graphql/1aafede5db8b75a7f2f9ad3102b2758dc4579231/Lib/.DS_Store -------------------------------------------------------------------------------- /Lib/analog/analog/.gitignore: -------------------------------------------------------------------------------- 1 | vendor/* 2 | /composer.lock 3 | -------------------------------------------------------------------------------- /Lib/analog/analog/.travis.yml: -------------------------------------------------------------------------------- 1 | language: php 2 | php: 3 | - 5.3 4 | - 5.4 5 | - 5.5 6 | - 5.6 7 | - 7.0 8 | - hhvm 9 | 10 | before_script: composer install --no-interaction --prefer-source 11 | script: phpunit --coverage-text --verbose 12 | -------------------------------------------------------------------------------- /Lib/analog/analog/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License 2 | 3 | Copyright (c) 2012 Johnny Broadway 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /Lib/analog/analog/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "analog/analog", 3 | "type": "library", 4 | "description": "PHP 5.3+ micro logging class that can be extended via closures. Includes several pre-built handlers including file, mail, syslog, HTTP post, and MongoDB.", 5 | "keywords": ["log", "logging", "logger", "syslog", "error", "debug", "debugging", "alerts"], 6 | "homepage": "https://github.com/jbroadway/analog", 7 | "license": "MIT", 8 | "authors": [ 9 | { 10 | "name": "Johnny Broadway", 11 | "email": "johnny@johnnybroadway.com", 12 | "homepage": "http://www.johnnybroadway.com/" 13 | } 14 | ], 15 | "require": { 16 | "psr/log": "1.*", 17 | "php": ">=5.3.2" 18 | }, 19 | "autoload": { 20 | "psr-0": { 21 | "Analog": "lib/" 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Lib/analog/analog/examples/amon.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Lib/analog/analog/examples/buffer.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Lib/analog/analog/examples/chromelogger.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Lib/analog/analog/examples/default.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Lib/analog/analog/examples/file.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Lib/analog/analog/examples/firephp.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Lib/analog/analog/examples/gelf.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Lib/analog/analog/examples/ignore.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Lib/analog/analog/examples/levelbuffer.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Lib/analog/analog/examples/mail.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Lib/analog/analog/examples/mongo.php: -------------------------------------------------------------------------------- 1 | testing->log->find (); 16 | foreach ($cur as $doc) { 17 | print_r ($doc); 18 | } 19 | $m->testing->log->remove (); 20 | 21 | ?> 22 | -------------------------------------------------------------------------------- /Lib/analog/analog/examples/multi.php: -------------------------------------------------------------------------------- 1 | Analog\Handler\Variable::init ($errors), 11 | Analog::WARNING => Analog\Handler\Variable::init ($warnings), 12 | Analog::DEBUG => Analog\Handler\Variable::init ($debug) 13 | ))); 14 | 15 | Analog::log ('First error'); 16 | Analog::log ('Emergency!', Analog::URGENT); 17 | Analog::log ('A warning...', Analog::WARNING); 18 | Analog::log ('Some info', Analog::INFO); 19 | Analog::log ('Debugging output', Analog::DEBUG); 20 | 21 | echo $errors; 22 | echo "-----\n"; 23 | echo $warnings; 24 | echo "-----\n"; 25 | echo $debug; 26 | 27 | ?> -------------------------------------------------------------------------------- /Lib/analog/analog/examples/post.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Lib/analog/analog/examples/psr-0.php: -------------------------------------------------------------------------------- 1 | register (); 7 | 8 | use \Analog\Analog; 9 | 10 | $log = ''; 11 | 12 | Analog::handler (\Analog\Handler\Variable::init ($log)); 13 | 14 | Analog::log ('Test one'); 15 | Analog::log ('Test two'); 16 | 17 | echo $log; 18 | 19 | ?> -------------------------------------------------------------------------------- /Lib/analog/analog/examples/server.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Lib/analog/analog/examples/stderr.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Lib/analog/analog/examples/syslog.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Lib/analog/analog/examples/threshold.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Lib/analog/analog/examples/variable.php: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Lib/analog/analog/lib/Analog.php: -------------------------------------------------------------------------------- 1 | $host, 24 | 'port' => $port, 25 | 'application_key' => $key 26 | )); 27 | 28 | $tags = array ( 29 | 0 => 'urgent', 30 | 1 => 'alert', 31 | 2 => 'critical', 32 | 3 => 'error', 33 | 4 => 'warning', 34 | 5 => 'notice', 35 | 6 => 'info', 36 | 7 => 'debug' 37 | ); 38 | 39 | return function ($info) use ($tags) { 40 | \Amon::log ($info, array ($tags[$info['level']])); 41 | }; 42 | } 43 | } -------------------------------------------------------------------------------- /Lib/analog/analog/lib/Analog/Handler/Buffer.php: -------------------------------------------------------------------------------- 1 | 'LOG', 25 | \Analog\Analog::INFO => 'INFO', 26 | \Analog\Analog::NOTICE => 'INFO', 27 | \Analog\Analog::WARNING => 'WARN', 28 | \Analog\Analog::ERROR => 'ERROR', 29 | \Analog\Analog::CRITICAL => 'ERROR', 30 | \Analog\Analog::ALERT => 'ERROR', 31 | \Analog\Analog::URGENT => 'ERROR' 32 | ); 33 | 34 | /** 35 | * Message index increases by 1 each time a message is sent. 36 | */ 37 | private static $message_index = 1; 38 | 39 | /** 40 | * Formats a log header to be sent. 41 | */ 42 | public static function format_header ($info) { 43 | if (is_array ($info['message'])) { 44 | $extra = array ( 45 | 'Type' => self::$log_levels[$info['level']], 46 | 'File' => $info['message'][1], 47 | 'Line' => $info['message'][2] 48 | ); 49 | $info['message'] = $info['message'][0]; 50 | } else { 51 | $extra = array ('Type' => self::$log_levels[$info['level']]); 52 | } 53 | 54 | $json = json_encode (array ($extra, $info['message'])); 55 | 56 | return sprintf ('X-Wf-1-1-1-%d: %s|%s|', self::$message_index++, strlen ($json), $json); 57 | } 58 | 59 | /** 60 | * Sends the initial headers if FirePHP is available then returns a 61 | * closure that handles sending log messages. 62 | */ 63 | public static function init () { 64 | if (! isset ($_SERVER['HTTP_USER_AGENT']) 65 | || preg_match ('{\bFirePHP/\d+\.\d+\b}', $_SERVER['HTTP_USER_AGENT']) 66 | || isset ($_SERVER['HTTP_X_FIREPHP_VERSION'])) { 67 | 68 | header ('X-Wf-Protocol-1: http://meta.wildfirehq.org/Protocol/JsonStream/0.2'); 69 | header ('X-Wf-1-Plugin-1: http://meta.firephp.org/Wildfire/Plugin/FirePHP/Library-FirePHPCore/0.3'); 70 | header ('X-Wf-1-Structure-1: http://meta.firephp.org/Wildfire/Structure/FirePHP/FirebugConsole/0.1'); 71 | } 72 | 73 | return function ($info) { 74 | header (FirePHP::format_header ($info)); 75 | }; 76 | } 77 | } -------------------------------------------------------------------------------- /Lib/analog/analog/lib/Analog/Handler/GELF.php: -------------------------------------------------------------------------------- 1 | setHost ($info['machine']); 33 | $message->setLevel ($info['level']); 34 | 35 | if (is_array ($info['message'])) { 36 | $message->setShortMessage ($info['message'][0]); 37 | $message->setFullMessage ($info['message'][0]); 38 | $message->setFile ($info['message'][1]); 39 | $message->setLine ($info['message'][2]); 40 | } else { 41 | $message->setShortMessage ($info['message']); 42 | $message->setFullMessage ($info['message']); 43 | } 44 | 45 | $publisher->publish ($message); 46 | }; 47 | } 48 | } -------------------------------------------------------------------------------- /Lib/analog/analog/lib/Analog/Handler/Ignore.php: -------------------------------------------------------------------------------- 1 | 'DEBUG', 24 | \Analog\Analog::INFO => 'INFO', 25 | \Analog\Analog::NOTICE => 'NOTICE', 26 | \Analog\Analog::WARNING => 'WARNING', 27 | \Analog\Analog::ERROR => 'ERROR', 28 | \Analog\Analog::CRITICAL => 'CRITICAL', 29 | \Analog\Analog::ALERT => 'ALERT', 30 | \Analog\Analog::URGENT => 'URGENT' 31 | ); 32 | 33 | /** 34 | * This contains the handler to send to 35 | */ 36 | public static $handler; 37 | 38 | public static function init ($handler) { 39 | self::$handler = $handler; 40 | 41 | return function ($info) { 42 | if (isset(self::$log_levels[$info['level']])) { 43 | $info['level'] = self::$log_levels[$info['level']]; 44 | } 45 | $handler = LevelName::$handler; 46 | $handler ($info); 47 | }; 48 | } 49 | 50 | } -------------------------------------------------------------------------------- /Lib/analog/analog/lib/Analog/Handler/Mail.php: -------------------------------------------------------------------------------- 1 | insert($info); 39 | $dbAndColl = $database.'.'.$collection; 40 | $manager->executeBulkWrite($dbAndColl, $bulk); 41 | }; 42 | } else { 43 | if ($server instanceof \MongoClient) { 44 | $db = $server->{$database}; 45 | } else { 46 | $conn = new \MongoClient ("mongodb://$server"); 47 | $db = $conn->{$database}; 48 | } 49 | return function ($info) use ($db, $collection) { 50 | $db->{$collection}->insert ($info); 51 | }; 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Lib/analog/analog/lib/Analog/Handler/Multi.php: -------------------------------------------------------------------------------- 1 | array( 14 | * Analog\Handler\Mail::init( $to, $subject, $from ), 15 | * Analog\Handler\Stderr::init() 16 | * ), 17 | * 18 | * // Warnings are sent here 19 | * Analog::WARNING => Analog\Handler\File::init( 'logs/warnings.log' ), 20 | * 21 | * // Debug and info messages sent here 22 | * Analog::DEBUG => Analog\Handler\Ignore::init() // do nothing 23 | * ) ) ); 24 | * 25 | * // will be ignored 26 | * Analog::log ('Ignore me', Analog::DEBUG); 27 | * 28 | * // will be written to logs/warnings.log 29 | * Analog::log ('Log me', Analog::WARNING); 30 | * 31 | * // will trigger an email notice 32 | * Analog::log ('Uh oh...', Analog::ERROR); 33 | */ 34 | class Multi { 35 | public static function init ($handlers) { 36 | return function ($info) use ($handlers) { 37 | $level = is_numeric ($info['level']) ? $info['level'] : 3; 38 | while ($level <= 7) { 39 | if ( isset ( $handlers[ $level ] ) ) { 40 | 41 | if ( ! is_array( $handlers[ $level ] ) ) { 42 | $handlers[ $level ] = array( $handlers[ $level ] ); 43 | } 44 | 45 | foreach ( $handlers[ $level ] as $handler ) { 46 | $handler( $info ); 47 | } 48 | 49 | return; 50 | } 51 | $level++; 52 | } 53 | }; 54 | } 55 | } -------------------------------------------------------------------------------- /Lib/analog/analog/lib/Analog/Handler/Null.php: -------------------------------------------------------------------------------- 1 | LOG_DEBUG, 16 | \Analog\Analog::INFO => LOG_INFO, 17 | \Analog\Analog::NOTICE => LOG_NOTICE, 18 | \Analog\Analog::WARNING => LOG_WARNING, 19 | \Analog\Analog::ERROR => LOG_ERR, 20 | \Analog\Analog::CRITICAL => LOG_CRIT, 21 | \Analog\Analog::ALERT => LOG_ALERT, 22 | \Analog\Analog::URGENT => LOG_EMERG 23 | ); 24 | 25 | public static $facilities = array ( 26 | 'auth' => LOG_AUTH, 27 | 'authpriv' => LOG_AUTHPRIV, 28 | 'cron' => LOG_CRON, 29 | 'daemon' => LOG_DAEMON, 30 | 'kern' => LOG_KERN, 31 | 'lpr' => LOG_LPR, 32 | 'mail' => LOG_MAIL, 33 | 'news' => LOG_NEWS, 34 | 'syslog' => LOG_SYSLOG, 35 | 'user' => LOG_USER, 36 | 'uucp' => LOG_UUCP 37 | ); 38 | 39 | public static function init ($ident, $facility) { 40 | if (! defined ('PHP_WINDOWS_VERSION_BUILD')) { 41 | self::$facilities['local0'] = LOG_LOCAL0; 42 | self::$facilities['local1'] = LOG_LOCAL1; 43 | self::$facilities['local2'] = LOG_LOCAL2; 44 | self::$facilities['local3'] = LOG_LOCAL3; 45 | self::$facilities['local4'] = LOG_LOCAL4; 46 | self::$facilities['local5'] = LOG_LOCAL5; 47 | self::$facilities['local6'] = LOG_LOCAL6; 48 | self::$facilities['local7'] = LOG_LOCAL7; 49 | } 50 | 51 | if (array_key_exists (strtolower ($facility), self::$facilities)) { 52 | $facility = self::$facilities[strtolower ($facility)]; 53 | } elseif (! in_array ($facility, array_values (self::$facilities), true)) { 54 | throw new \UnexpectedValueException ('Unknown facility value "' . $facility . '"'); 55 | } 56 | 57 | return function ($info) use ($ident, $facility) { 58 | if (! openlog ($ident, LOG_PID, $facility)) { 59 | throw new \LogicException ('Can\'t open syslog for ident "' . $ident . '" and facility "' . $facility . '"'); 60 | } 61 | 62 | syslog (Syslog::$levels[$info['level']], vsprintf ('%1$s: %4$s', $info)); 63 | 64 | closelog (); 65 | }; 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /Lib/analog/analog/lib/Analog/Handler/Threshold.php: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | ./tests 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /Lib/analog/analog/tests/PsrLogCompatTest.php: -------------------------------------------------------------------------------- 1 | handler (Variable::init ($this->log)); 17 | $logger->format ("%3\$d %4\$s\n"); 18 | return $logger; 19 | } 20 | 21 | public function getLogs () { 22 | $logger = $this->getLogger (); 23 | 24 | $logs = explode ("\n", trim ($this->log)); 25 | 26 | foreach ($logs as $key => $line) { 27 | list ($level, $msg) = explode (' ', $line, 2); 28 | $logs[$key] = $logger->convert_log_level ((int) $level, true) . ' ' . $msg; 29 | } 30 | 31 | return $logs; 32 | } 33 | } -------------------------------------------------------------------------------- /Lib/analog/analog/tests/bootstrap.php: -------------------------------------------------------------------------------- 1 | $vendorDir . '/ivome/graphql-relay-php/src/Connection/ArrayConnection.php', 10 | 'GraphQLRelay\\Connection\\Connection' => $vendorDir . '/ivome/graphql-relay-php/src/Connection/Connection.php', 11 | 'GraphQLRelay\\Mutation\\Mutation' => $vendorDir . '/ivome/graphql-relay-php/src/Mutation/Mutation.php', 12 | 'GraphQLRelay\\Node\\Node' => $vendorDir . '/ivome/graphql-relay-php/src/Node/Node.php', 13 | 'GraphQLRelay\\Node\\Plural' => $vendorDir . '/ivome/graphql-relay-php/src/Node/Plural.php', 14 | 'GraphQLRelay\\Relay' => $vendorDir . '/ivome/graphql-relay-php/src/Relay.php', 15 | ); 16 | -------------------------------------------------------------------------------- /Lib/composer/autoload_files.php: -------------------------------------------------------------------------------- 1 | $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php', 10 | '65fec9ebcfbb3cbb4fd0d519687aea01' => $vendorDir . '/danielstjules/stringy/src/Create.php', 11 | ); 12 | -------------------------------------------------------------------------------- /Lib/composer/autoload_namespaces.php: -------------------------------------------------------------------------------- 1 | array($vendorDir . '/analog/analog/lib'), 10 | ); 11 | -------------------------------------------------------------------------------- /Lib/composer/autoload_psr4.php: -------------------------------------------------------------------------------- 1 | array($vendorDir . '/symfony/polyfill-mbstring'), 10 | 'Stringy\\' => array($vendorDir . '/danielstjules/stringy/src'), 11 | 'Psr\\Log\\' => array($vendorDir . '/psr/log/Psr/Log'), 12 | 'Mohiohio\\WordPress\\' => array($vendorDir . '/mohiohio/wordpress-lib/src'), 13 | 'GraphQL\\' => array($vendorDir . '/webonyx/graphql-php/src'), 14 | 'CI\\GraphQLWP\\' => array($baseDir . '/'), 15 | ); 16 | -------------------------------------------------------------------------------- /Lib/composer/autoload_real.php: -------------------------------------------------------------------------------- 1 | = 50600 && !defined('HHVM_VERSION'); 27 | if ($useStaticLoader) { 28 | require_once __DIR__ . '/autoload_static.php'; 29 | 30 | call_user_func(\Composer\Autoload\ComposerStaticInitfc3dd94dac1010550de029e81b08f126::getInitializer($loader)); 31 | } else { 32 | $map = require __DIR__ . '/autoload_namespaces.php'; 33 | foreach ($map as $namespace => $path) { 34 | $loader->set($namespace, $path); 35 | } 36 | 37 | $map = require __DIR__ . '/autoload_psr4.php'; 38 | foreach ($map as $namespace => $path) { 39 | $loader->setPsr4($namespace, $path); 40 | } 41 | 42 | $classMap = require __DIR__ . '/autoload_classmap.php'; 43 | if ($classMap) { 44 | $loader->addClassMap($classMap); 45 | } 46 | } 47 | 48 | $loader->register(true); 49 | 50 | if ($useStaticLoader) { 51 | $includeFiles = Composer\Autoload\ComposerStaticInitfc3dd94dac1010550de029e81b08f126::$files; 52 | } else { 53 | $includeFiles = require __DIR__ . '/autoload_files.php'; 54 | } 55 | foreach ($includeFiles as $fileIdentifier => $file) { 56 | composerRequirefc3dd94dac1010550de029e81b08f126($fileIdentifier, $file); 57 | } 58 | 59 | return $loader; 60 | } 61 | } 62 | 63 | function composerRequirefc3dd94dac1010550de029e81b08f126($fileIdentifier, $file) 64 | { 65 | if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) { 66 | require $file; 67 | 68 | $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /Lib/danielstjules/stringy/LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright (C) 2013 Daniel St. Jules 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /Lib/danielstjules/stringy/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "danielstjules/stringy", 3 | "description": "A string manipulation library with multibyte support", 4 | "keywords": [ 5 | "multibyte", "string", "manipulation", "utility", "methods", "utf-8", 6 | "helpers", "utils", "utf" 7 | ], 8 | "homepage": "https://github.com/danielstjules/Stringy", 9 | "license": "MIT", 10 | "authors": [ 11 | { 12 | "name": "Daniel St. Jules", 13 | "email": "danielst.jules@gmail.com", 14 | "homepage": "http://www.danielstjules.com" 15 | } 16 | ], 17 | "require": { 18 | "php": ">=5.3.0", 19 | "symfony/polyfill-mbstring": "~1.1" 20 | }, 21 | "require-dev": { 22 | "phpunit/phpunit": "~4.0" 23 | }, 24 | "support": { 25 | "issues": "https://github.com/danielstjules/Stringy/issues", 26 | "source": "https://github.com/danielstjules/Stringy" 27 | }, 28 | "autoload": { 29 | "psr-4": { "Stringy\\": "src/" }, 30 | "files": ["src/Create.php"] 31 | }, 32 | "autoload-dev": { 33 | "classmap": [ "tests" ] 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Lib/danielstjules/stringy/src/Create.php: -------------------------------------------------------------------------------- 1 | =5.4,<8.0-DEV", 14 | "webonyx/graphql-php": ">=0.5.7,<0.7.0" 15 | }, 16 | "require-dev": { 17 | "phpunit/phpunit": "^4.8", 18 | "satooshi/php-coveralls": "~1.0" 19 | }, 20 | "config": { 21 | "bin-dir": "bin" 22 | }, 23 | "autoload": { 24 | "classmap": [ 25 | "src/" 26 | ] 27 | }, 28 | "autoload-dev": { 29 | "classmap": [ 30 | "tests/" 31 | ], 32 | "files": [ 33 | ] 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Lib/ivome/graphql-relay-php/contributors.txt: -------------------------------------------------------------------------------- 1 | Ivo Meißner 2 | -------------------------------------------------------------------------------- /Lib/ivome/graphql-relay-php/phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | tests 5 | 6 | 7 | 8 | 9 | ./vendor 10 | ./bin 11 | 12 | 13 | -------------------------------------------------------------------------------- /Lib/ivome/graphql-relay-php/src/Node/Plural.php: -------------------------------------------------------------------------------- 1 | ?any, 22 | * description?: ?string, 23 | * }; 24 | * 25 | * @param array $config 26 | * @return array 27 | */ 28 | public static function pluralIdentifyingRootField(array $config) 29 | { 30 | $inputArgs = []; 31 | $argName = self::getArrayValue($config, 'argName'); 32 | $inputArgs[$argName] = [ 33 | 'type' => Type::nonNull( 34 | Type::listOf( 35 | Type::nonNull(self::getArrayValue($config, 'inputType')) 36 | ) 37 | ) 38 | ]; 39 | 40 | return [ 41 | 'description' => isset($config['description']) ? $config['description'] : null, 42 | 'type' => Type::listOf(self::getArrayValue($config, 'outputType')), 43 | 'args' => $inputArgs, 44 | 'resolve' => function ($obj, $args, $info) use ($argName, $config) { 45 | $inputs = $args[$argName]; 46 | return array_map(function($input) use ($config, $info) { 47 | return call_user_func(self::getArrayValue($config, 'resolveSingleInput'), $input, $info); 48 | }, $inputs); 49 | } 50 | ]; 51 | } 52 | 53 | /** 54 | * Returns the value for the given array key, NULL, if it does not exist 55 | * 56 | * @param array $array 57 | * @param string $key 58 | * @return mixed 59 | */ 60 | protected static function getArrayValue(array $array, $key) 61 | { 62 | if (array_key_exists($key, $array)){ 63 | return $array[$key]; 64 | } else { 65 | throw new \InvalidArgumentException('The config value for "' . $key . '" is required, but missing in PluralIdentifyingRootFieldConfig."'); 66 | } 67 | } 68 | } -------------------------------------------------------------------------------- /Lib/ivome/graphql-relay-php/tests/RelayTest.php: -------------------------------------------------------------------------------- 1 | assertEquals( 22 | Connection::forwardConnectionArgs(), 23 | Relay::forwardConnectionArgs() 24 | ); 25 | } 26 | 27 | public function testBackwardConnectionArgs() 28 | { 29 | $this->assertEquals( 30 | Connection::backwardConnectionArgs(), 31 | Relay::backwardConnectionArgs() 32 | ); 33 | } 34 | 35 | public function testConnectionArgs() 36 | { 37 | $this->assertEquals( 38 | Connection::connectionArgs(), 39 | Relay::connectionArgs() 40 | ); 41 | } 42 | } -------------------------------------------------------------------------------- /Lib/ivome/graphql-relay-php/tests/StarWarsMutationTest.php: -------------------------------------------------------------------------------- 1 | 32 | array ( 33 | 'shipName' => 'B-Wing', 34 | 'factionId' => '1', 35 | 'clientMutationId' => 'abcde', 36 | ), 37 | ); 38 | 39 | $expected = array ( 40 | 'introduceShip' => 41 | array ( 42 | 'ship' => 43 | array ( 44 | 'id' => 'U2hpcDo5', 45 | 'name' => 'B-Wing', 46 | ), 47 | 'faction' => 48 | array ( 49 | 'name' => 'Alliance to Restore the Republic', 50 | ), 51 | 'clientMutationId' => 'abcde', 52 | ), 53 | ); 54 | 55 | $result = GraphQL::execute(StarWarsSchema::getSchema(), $mutation, null, $params); 56 | 57 | $this->assertEquals(['data' => $expected], $result); 58 | } 59 | } -------------------------------------------------------------------------------- /Lib/mohiohio/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whuysmans/vuewp-graphql/1aafede5db8b75a7f2f9ad3102b2758dc4579231/Lib/mohiohio/.DS_Store -------------------------------------------------------------------------------- /Lib/mohiohio/wordpress-lib/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whuysmans/vuewp-graphql/1aafede5db8b75a7f2f9ad3102b2758dc4579231/Lib/mohiohio/wordpress-lib/.DS_Store -------------------------------------------------------------------------------- /Lib/mohiohio/wordpress-lib/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "mohiohio/wordpress-lib", 3 | "type": "library", 4 | "description": "WordPress Utilities", 5 | "keywords": ["wordpress","library","php"], 6 | "homepage": "http://www.mohiohio.com", 7 | "license": "GPLv3", 8 | "authors": [ 9 | { 10 | "name": "Tim Field", 11 | "email": "field.tim@gmail.com", 12 | "role": "Developer" 13 | } 14 | ], 15 | "require": { 16 | "php": ">=5.5.0" 17 | }, 18 | "autoload": { 19 | "psr-4": {"Mohiohio\\WordPress\\": "src/"} 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Lib/mohiohio/wordpress-lib/src/Admin.php: -------------------------------------------------------------------------------- 1 | get_default_section(); 44 | } 45 | 46 | $this->fields[$field['name']] = $field; 47 | } 48 | 49 | function create_section($title,$id=null) 50 | { 51 | if(!$id) { $id = $title; } 52 | 53 | return new Setting\Section($id, $title, null, $this->get_settings_namespace()); 54 | } 55 | 56 | function render() { 57 | 58 | $field_objects = array_map(function($data){ 59 | return new Setting\Field($data); 60 | }, $this->fields); 61 | 62 | new Setting\Page([ 63 | 'setting' => $this->get_settings_namespace(), 64 | 'display_name' => $this->get_page_name(), 65 | 'intro' => $this->get_intro(), 66 | 'header' => $this->get_header(), 67 | 'setting_fields' => $field_objects, 68 | 'capability' => $this->capability 69 | ]); 70 | } 71 | 72 | function get_section(Setting\Section $section=null){ 73 | 74 | if(!$section){ 75 | $section = $this->get_default_section(); 76 | } 77 | 78 | return $section; 79 | } 80 | 81 | function get_default_section(){ 82 | 83 | static $section; 84 | 85 | if(!$section){ 86 | 87 | $id = $this->section_id ?: $this->section_title; 88 | 89 | $section = new Setting\Section($this->section_id, $this->section_title, null, $this->get_settings_namespace()); 90 | } 91 | 92 | return $section; 93 | } 94 | 95 | function get_intro() { 96 | return null; 97 | } 98 | 99 | function get_header() { 100 | return null; 101 | } 102 | 103 | static function get_setting($name,$default=null){ 104 | return WordPress::get_option(static::get_settings_namespace(),$name, $default); 105 | } 106 | 107 | } 108 | -------------------------------------------------------------------------------- /Lib/mohiohio/wordpress-lib/src/CustomPostType.php: -------------------------------------------------------------------------------- 1 | 20){ 13 | throw new \Exception('CPT type names have a max lenght of 20 chars'); 14 | } 15 | 16 | parent::__construct($type,$name,$info); 17 | 18 | $this->setup_post_type(); 19 | } 20 | 21 | protected function default_menu_icon(){ 22 | return null; 23 | } 24 | 25 | protected function default_taxonomies(){ 26 | return array(); 27 | } 28 | 29 | protected function default_public(){ 30 | return true; 31 | } 32 | 33 | protected function default_show_ui(){ 34 | return true; 35 | } 36 | 37 | protected function default_supports(){ 38 | return array( 39 | 'title', 40 | 'editor', 41 | 'thumbnail', 42 | 'excerpt', 43 | 'revisions', 44 | 'page-attributes' 45 | ); 46 | } 47 | 48 | protected function default_rewrite_with_front() { 49 | return true; 50 | } 51 | 52 | protected function setup_post_type() 53 | { 54 | add_action( 'init', function() { 55 | 56 | /** 57 | * Properties of $me are pulled from the $info array passed 58 | * to constructor. If they don't exist we look for a default_{property} method 59 | */ 60 | 61 | $plural = $this->plural; 62 | 63 | register_post_type( $this->type, [ 64 | 'label' => $plural, 65 | 'labels' => [ 66 | 'name' => $plural, 67 | 'singular_name' => $this->name, 68 | 'add_new_item' => 'Add New '.$this->name, 69 | 'edit_item' => 'Edit '.$this->name, 70 | 'new_item' => 'New '.$this->name, 71 | 'view_item' => 'View '.$this->name, 72 | 'search_items' => 'Search '.$plural, 73 | 'parent_item_colon' => 'Parent '.$this->name 74 | ], 75 | 'public' => $this->public, 76 | 'show_ui' => $this->show_ui, 77 | 'rewrite' => ['slug' => $this->slug, 'with_front' => $this->rewrite_with_front], 78 | 'menu_position' => $this->menu_position, 79 | 'menu_icon' => $this->menu_icon, 80 | 'hierarchical' => $this->hierarchical, 81 | 'supports'=> $this->supports, 82 | 'taxonomies' => $this->taxonomies, 83 | 'has_archive' => $this->has_archive 84 | ]); 85 | 86 | },99); // why 99 ? 87 | } 88 | } 89 | 90 | -------------------------------------------------------------------------------- /Lib/mohiohio/wordpress-lib/src/CustomTaxonomy.php: -------------------------------------------------------------------------------- 1 | object_type = $object_type; 14 | 15 | $this->register_taxonomy(); 16 | } 17 | 18 | protected function register_taxonomy() 19 | { 20 | 21 | add_action( 'init', function() { 22 | 23 | /** 24 | * Properties of $this are pulled from the $info array passed 25 | * to constructor. If they don't exist we look for a default_{property} method 26 | */ 27 | 28 | $plural = $this->plural; 29 | 30 | register_taxonomy($this->type, $this->object_type, array( 31 | // Hierarchical taxonomy (like categories) 32 | 'hierarchical' => $this->hierarchical, 33 | 'labels' => array( 34 | 'name' => _x( $plural, 'taxonomy general name' ), 35 | 'singular_name' => _x( $this->name, 'taxonomy singular name' ), 36 | 'search_items' => __( 'Search '.$plural ), 37 | 'all_items' => __( 'All '.$plural ), 38 | 'parent_item' => __( 'Parent '.$this->name ), 39 | 'parent_item_colon' => __( 'Parent '.$this->name ), 40 | 'edit_item' => __( 'Edit '.$this->name ), 41 | 'update_item' => __( 'Update '.$this->name ), 42 | 'add_new_item' => __( 'Add New '.$this->name ), 43 | 'new_item_name' => __( 'New '.$this->name ), 44 | 'menu_name' => __( $plural ), 45 | ), 46 | // Control the slugs used for this taxonomy 47 | 'rewrite' => array( 48 | 'slug' => $this->slug, // This controls the base slug that will display before each term 49 | 'with_front' => $this->rewrite_with_front, // Don't display the category base before "/locations/" 50 | 'hierarchical' => $this->rewrite_hierarchical// This will allow URL's like "/locations/boston/cambridge/" 51 | ), 52 | )); 53 | 54 | register_taxonomy_for_object_type( $this->type, $this->object_type ); 55 | 56 | },100); 57 | } 58 | 59 | protected function default_rewrite_with_front() { 60 | return false; 61 | } 62 | 63 | protected function default_rewrite_hierarchical() { 64 | return true; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /Lib/mohiohio/wordpress-lib/src/QuickConfig.php: -------------------------------------------------------------------------------- 1 | type = $type; 12 | $this->info = $info; 13 | $this->name = $name; 14 | } 15 | 16 | function __get($key) 17 | { 18 | if(isset($this->info[$key])) 19 | return $this->info[$key] instanceof \Closure ? $this->info[$key]() : $this->info[$key]; 20 | 21 | if(is_callable(array($this,'default_'.$key))) 22 | return $this->{'default_'.$key}(); 23 | 24 | return null; 25 | } 26 | 27 | protected function default_plural(){ 28 | 29 | $name = $this->name; 30 | 31 | $last = substr($name,-1); 32 | 33 | return $last == 'y' ? substr($name,0,-1).'ies' : $name.'s'; 34 | } 35 | 36 | protected function default_slug(){ 37 | return preg_replace('/[^a-z0-9]/','-', strtolower($this->plural)); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Lib/mohiohio/wordpress-lib/src/Router.php: -------------------------------------------------------------------------------- 1 | 'index.php?'.static::query_var_name($route).'=1']; 12 | return $newRule + $rules; 13 | 14 | }, $rules ); 15 | }); 16 | 17 | add_filter('query_vars', function($qvars) use ($url_callbacks) { 18 | 19 | return array_reduce(array_keys($url_callbacks), function($qvars, $route) { 20 | 21 | $qvars[] = static::query_var_name($route); 22 | return $qvars; 23 | 24 | },$qvars); 25 | }); 26 | 27 | add_action( 'template_redirect', function() use ($url_callbacks) { 28 | global $wp_query; 29 | foreach ($url_callbacks as $route => $callback) { 30 | if ($wp_query->get( static::query_var_name($route))) { 31 | $wp_query->is_home = false; 32 | $params = null; 33 | preg_match('#'.trim($route,'/').'#',$_SERVER['REQUEST_URI'],$params); 34 | $res = call_user_func_array($callback,$params); 35 | if($res === false) { 36 | static::send_404(); 37 | } else { 38 | exit(); 39 | } 40 | } 41 | } 42 | }, get_option('mohiohio/router-priority',$priority) ); 43 | 44 | add_action('init', function() use ($url_callbacks) { 45 | static::maybe_flush_rewrites($url_callbacks); 46 | }, 99); 47 | } 48 | 49 | static function write_log ( $log ) { 50 | if ( true === WP_DEBUG ) { 51 | if ( is_array( $log ) || is_object( $log ) ) { 52 | error_log( print_r( $log, true ) ); 53 | } else { 54 | error_log( $log ); 55 | } 56 | } 57 | } 58 | 59 | static protected function maybe_flush_rewrites($url_callbacks) { 60 | $current = md5(json_encode(array_keys($url_callbacks))); 61 | $cached = get_option(get_called_class(), null ); 62 | if ( empty( $cached ) || $current !== $cached ) { 63 | flush_rewrite_rules(); 64 | update_option(get_called_class(), $current ); 65 | } 66 | } 67 | 68 | static protected function query_var_name($route) { 69 | static $cache; 70 | if (!isset($cache[$route])) { 71 | $cache[$route] = md5($route); 72 | } 73 | return $cache[$route]; 74 | } 75 | 76 | static protected function send_404() { 77 | global $wp_query; 78 | status_header('404'); 79 | $wp_query->set_404(); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /Lib/mohiohio/wordpress-lib/src/Setting/Field.php: -------------------------------------------------------------------------------- 1 | null, 21 | 'section' => null, 22 | 'display_callback' => null, 23 | 'default' => null, 24 | 'type' => 'text', 25 | 'props' => [] 26 | ]; 27 | 28 | extract($name); 29 | } 30 | 31 | $this->name = $name; 32 | $this->title = $title; 33 | $this->display_callback = $display_callback; 34 | $this->section = $section; 35 | $this->default = $default; 36 | $this->type = $type; 37 | $this->props = $props; 38 | } 39 | 40 | function get_section() { 41 | return $this->section; 42 | } 43 | 44 | function get_display_callback($setting_group) { 45 | 46 | $options = get_option($setting_group); 47 | $value = isset($options[$this->name]) ? $options[$this->name] : $this->default; 48 | 49 | $props = $this->props += [ 50 | 'id'=> $setting_group.'_'.$this->name, 51 | 'name' => "{$setting_group}[{$this->name}]", 52 | 'placeholder'=> $this->default, 53 | 'type'=>$this->type, 54 | ]; 55 | 56 | return function() use ($value, $props) { 57 | 58 | if($this->display_callback instanceof \Closure) { 59 | 60 | call_user_func($this->display_callback, $value, $props); 61 | 62 | } else { 63 | 64 | switch($this->display_callback) { 65 | 66 | case 'textarea': 67 | echo static::textarea($value, $props); 68 | break; 69 | 70 | default: 71 | echo static::input($value, $props); 72 | } 73 | } 74 | }; 75 | } 76 | 77 | static function render_props($props){ 78 | return array_reduce(array_keys($props), function($render,$key) use ($props){ 79 | return $render.' '.$key.'="'. htmlspecialchars($props[$key]).'"'; 80 | },''); 81 | } 82 | 83 | static function input($value, $props) { 84 | $props += [ 85 | 'value' => $value 86 | ]; 87 | return ""; 88 | } 89 | 90 | static function textarea($value, $props) { 91 | $props += [ 92 | 'rows'=>10, 93 | 'cols'=>50, 94 | ]; 95 | return ""; 96 | } 97 | 98 | } 99 | -------------------------------------------------------------------------------- /Lib/mohiohio/wordpress-lib/src/Setting/Page.php: -------------------------------------------------------------------------------- 1 | '__required', 10 | 'setting_fields' => '__required', 11 | 'display_name' => null, 12 | 'header' => null, 13 | 'intro' => null, 14 | 'page_callback' => null, 15 | 'capability' => 'manage_options' 16 | ]; 17 | 18 | foreach($args as $k => $v) { 19 | if($v === '__required'){ 20 | throw new \Exception('Missing argument '.$k); 21 | } 22 | } 23 | 24 | extract($args); 25 | 26 | add_action('admin_menu', function() use($display_name, $setting, $page_callback, $capability, $intro, $header) { 27 | 28 | add_options_page($display_name, $display_name, $capability, $setting, function() use ($page_callback, $setting, $display_name, $intro, $header) { 29 | 30 | if($page_callback) 31 | $page_callback(); 32 | else { ?> 33 |
34 |

35 | 36 | 37 | 38 |
39 | 44 |
45 |
46 | get_section()->add(); 58 | 59 | add_settings_field($field->name, $field->title, $field->get_display_callback($setting), $setting, $field->get_section()->get_id()); 60 | } 61 | }); 62 | 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /Lib/mohiohio/wordpress-lib/src/Setting/Section.php: -------------------------------------------------------------------------------- 1 | id = $id; 21 | $this->title = $title; 22 | $this->callback = $callback; 23 | $this->page = $page ?: $id; 24 | } 25 | 26 | function get_id(){ 27 | return $this->id; 28 | } 29 | 30 | function add(){ 31 | 32 | if(!$this->added){ 33 | 34 | add_settings_section($this->id, $this->title, $this->callback, $this->page); 35 | 36 | } 37 | 38 | $this->added = true; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Lib/psr/log/.gitignore: -------------------------------------------------------------------------------- 1 | vendor 2 | -------------------------------------------------------------------------------- /Lib/psr/log/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012 PHP Framework Interoperability Group 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /Lib/psr/log/Psr/Log/InvalidArgumentException.php: -------------------------------------------------------------------------------- 1 | logger = $logger; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Lib/psr/log/Psr/Log/NullLogger.php: -------------------------------------------------------------------------------- 1 | logger) { }` 11 | * blocks. 12 | */ 13 | class NullLogger extends AbstractLogger 14 | { 15 | /** 16 | * Logs with an arbitrary level. 17 | * 18 | * @param mixed $level 19 | * @param string $message 20 | * @param array $context 21 | * 22 | * @return void 23 | */ 24 | public function log($level, $message, array $context = array()) 25 | { 26 | // noop 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Lib/psr/log/README.md: -------------------------------------------------------------------------------- 1 | PSR Log 2 | ======= 3 | 4 | This repository holds all interfaces/classes/traits related to 5 | [PSR-3](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md). 6 | 7 | Note that this is not a logger of its own. It is merely an interface that 8 | describes a logger. See the specification for more details. 9 | 10 | Usage 11 | ----- 12 | 13 | If you need a logger, you can use the interface like this: 14 | 15 | ```php 16 | logger = $logger; 27 | } 28 | 29 | public function doSomething() 30 | { 31 | if ($this->logger) { 32 | $this->logger->info('Doing work'); 33 | } 34 | 35 | // do something useful 36 | } 37 | } 38 | ``` 39 | 40 | You can then pick one of the implementations of the interface to get a logger. 41 | 42 | If you want to implement the interface, you can require this package and 43 | implement `Psr\Log\LoggerInterface` in your code. Please read the 44 | [specification text](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md) 45 | for details. 46 | -------------------------------------------------------------------------------- /Lib/psr/log/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "psr/log", 3 | "description": "Common interface for logging libraries", 4 | "keywords": ["psr", "psr-3", "log"], 5 | "homepage": "https://github.com/php-fig/log", 6 | "license": "MIT", 7 | "authors": [ 8 | { 9 | "name": "PHP-FIG", 10 | "homepage": "http://www.php-fig.org/" 11 | } 12 | ], 13 | "require": { 14 | "php": ">=5.3.0" 15 | }, 16 | "autoload": { 17 | "psr-4": { 18 | "Psr\\Log\\": "Psr/Log/" 19 | } 20 | }, 21 | "extra": { 22 | "branch-alias": { 23 | "dev-master": "1.0.x-dev" 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Lib/symfony/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whuysmans/vuewp-graphql/1aafede5db8b75a7f2f9ad3102b2758dc4579231/Lib/symfony/.DS_Store -------------------------------------------------------------------------------- /Lib/symfony/polyfill-mbstring/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014-2016 Fabien Potencier 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is furnished 8 | to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /Lib/symfony/polyfill-mbstring/README.md: -------------------------------------------------------------------------------- 1 | Symfony Polyfill / Mbstring 2 | =========================== 3 | 4 | This component provides a partial, native PHP implementation for the 5 | [Mbstring](http://php.net/mbstring) extension. 6 | 7 | More information can be found in the 8 | [main Polyfill README](https://github.com/symfony/polyfill/blob/master/README.md). 9 | 10 | License 11 | ======= 12 | 13 | This library is released under the [MIT license](LICENSE). 14 | -------------------------------------------------------------------------------- /Lib/symfony/polyfill-mbstring/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "symfony/polyfill-mbstring", 3 | "type": "library", 4 | "description": "Symfony polyfill for the Mbstring extension", 5 | "keywords": ["polyfill", "shim", "compatibility", "portable", "mbstring"], 6 | "homepage": "https://symfony.com", 7 | "license": "MIT", 8 | "authors": [ 9 | { 10 | "name": "Nicolas Grekas", 11 | "email": "p@tchwork.com" 12 | }, 13 | { 14 | "name": "Symfony Community", 15 | "homepage": "https://symfony.com/contributors" 16 | } 17 | ], 18 | "require": { 19 | "php": ">=5.3.3" 20 | }, 21 | "autoload": { 22 | "psr-4": { "Symfony\\Polyfill\\Mbstring\\": "" }, 23 | "files": [ "bootstrap.php" ] 24 | }, 25 | "suggest": { 26 | "ext-mbstring": "For best performance" 27 | }, 28 | "minimum-stability": "dev", 29 | "extra": { 30 | "branch-alias": { 31 | "dev-master": "1.3-dev" 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Lib/webonyx/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/whuysmans/vuewp-graphql/1aafede5db8b75a7f2f9ad3102b2758dc4579231/Lib/webonyx/.DS_Store -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/.gitignore: -------------------------------------------------------------------------------- 1 | .idea/ 2 | composer.phar 3 | composer.lock 4 | vendor/ 5 | bin/ 6 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/.travis.yml: -------------------------------------------------------------------------------- 1 | language: php 2 | 3 | php: 4 | - 5.4 5 | - 5.5 6 | - 5.6 7 | - 7.0 8 | - nightly 9 | - hhvm 10 | 11 | install: 12 | - composer install --prefer-dist 13 | 14 | script: 15 | - ./bin/phpunit tests/ 16 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015, webonyx 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | * Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 10 | * Redistributions in binary form must reproduce the above copyright notice, 11 | this list of conditions and the following disclaimer in the documentation 12 | and/or other materials provided with the distribution. 13 | 14 | * Neither the name of graphql-php nor the names of its 15 | contributors may be used to endorse or promote products derived from 16 | this software without specific prior written permission. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 22 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 23 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 24 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 25 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 26 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | 29 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "webonyx/graphql-php", 3 | "description": "A PHP port of GraphQL reference implementation", 4 | "type": "library", 5 | "license": "BSD", 6 | "homepage": "https://github.com/webonyx/graphql-php", 7 | "keywords": [ 8 | "graphql", 9 | "API" 10 | ], 11 | "require": { 12 | "php": ">=5.4,<8.0-DEV" 13 | }, 14 | "require-dev": { 15 | "phpunit/phpunit": "^4.8" 16 | }, 17 | "config": { 18 | "bin-dir": "bin" 19 | }, 20 | "autoload": { 21 | "psr-4": { 22 | "GraphQL\\": "src/" 23 | } 24 | }, 25 | "autoload-dev": { 26 | "psr-4": { 27 | "GraphQL\\Tests\\": "tests/" 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/phpunit.xml.dist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 14 | 15 | 16 | ./tests/ 17 | 18 | 19 | 20 | 21 | 22 | ./ 23 | 24 | ./tests 25 | ./vendor 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/src/Executor/ExecutionContext.php: -------------------------------------------------------------------------------- 1 | 23 | */ 24 | public $fragments; 25 | 26 | /** 27 | * @var 28 | */ 29 | public $rootValue; 30 | 31 | /** 32 | * @var OperationDefinition 33 | */ 34 | public $operation; 35 | 36 | /** 37 | * @var array 38 | */ 39 | public $variableValues; 40 | 41 | /** 42 | * @var array 43 | */ 44 | public $errors; 45 | 46 | /** 47 | * @var array 48 | */ 49 | public $memoized = []; 50 | 51 | public function __construct($schema, $fragments, $root, $operation, $variables, $errors) 52 | { 53 | $this->schema = $schema; 54 | $this->fragments = $fragments; 55 | $this->rootValue = $root; 56 | $this->operation = $operation; 57 | $this->variableValues = $variables; 58 | $this->errors = $errors ?: []; 59 | } 60 | 61 | public function addError(Error $error) 62 | { 63 | $this->errors[] = $error; 64 | return $this; 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/src/Executor/ExecutionResult.php: -------------------------------------------------------------------------------- 1 | data = $data; 31 | $this->errors = $errors; 32 | $this->extensions = $extensions; 33 | } 34 | 35 | /** 36 | * @return array 37 | */ 38 | public function toArray() 39 | { 40 | $result = ['data' => $this->data]; 41 | 42 | if (!empty($this->errors)) { 43 | $result['errors'] = array_map(['GraphQL\Error', 'formatError'], $this->errors); 44 | } 45 | 46 | if (!empty($this->extensions)) { 47 | $result['extensions'] = (array) $this->extensions; 48 | } 49 | 50 | return $result; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/src/FormattedError.php: -------------------------------------------------------------------------------- 1 | $error 17 | ]; 18 | 19 | if (!empty($locations)) { 20 | $formatted['locations'] = array_map(function($loc) { return $loc->toArray();}, $locations); 21 | } 22 | 23 | return $formatted; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/src/GraphQL.php: -------------------------------------------------------------------------------- 1 | |null $variableValues 18 | * @param string|null $operationName 19 | * @return array 20 | */ 21 | public static function execute(Schema $schema, $requestString, $rootValue = null, $variableValues = null, $operationName = null) 22 | { 23 | return self::executeAndReturnResult($schema, $requestString, $rootValue, $variableValues, $operationName)->toArray(); 24 | } 25 | 26 | /** 27 | * @param Schema $schema 28 | * @param $requestString 29 | * @param null $rootValue 30 | * @param null $variableValues 31 | * @param null $operationName 32 | * @return array|ExecutionResult 33 | */ 34 | public static function executeAndReturnResult(Schema $schema, $requestString, $rootValue = null, $variableValues = null, $operationName = null) 35 | { 36 | try { 37 | $source = new Source($requestString ?: '', 'GraphQL request'); 38 | $documentAST = Parser::parse($source); 39 | 40 | /** @var QueryComplexity $queryComplexity */ 41 | $queryComplexity = DocumentValidator::getRule('QueryComplexity'); 42 | $queryComplexity->setRawVariableValues($variableValues); 43 | 44 | $validationErrors = DocumentValidator::validate($schema, $documentAST); 45 | 46 | if (!empty($validationErrors)) { 47 | return new ExecutionResult(null, $validationErrors); 48 | } else { 49 | return Executor::execute($schema, $documentAST, $rootValue, $variableValues, $operationName); 50 | } 51 | } catch (Error $e) { 52 | return new ExecutionResult(null, [$e]); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/src/Language/AST/Argument.php: -------------------------------------------------------------------------------- 1 | 10 | */ 11 | public $definitions; 12 | } 13 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/src/Language/AST/EnumValue.php: -------------------------------------------------------------------------------- 1 | |null 20 | */ 21 | public $arguments; 22 | 23 | /** 24 | * @var array|null 25 | */ 26 | public $directives; 27 | 28 | /** 29 | * @var SelectionSet|null 30 | */ 31 | public $selectionSet; 32 | } 33 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/src/Language/AST/FloatValue.php: -------------------------------------------------------------------------------- 1 | 21 | */ 22 | public $directives; 23 | 24 | /** 25 | * @var SelectionSet 26 | */ 27 | public $selectionSet; 28 | } 29 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/src/Language/AST/FragmentSpread.php: -------------------------------------------------------------------------------- 1 | 15 | */ 16 | public $directives; 17 | } 18 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/src/Language/AST/InlineFragment.php: -------------------------------------------------------------------------------- 1 | |null 15 | */ 16 | public $directives; 17 | 18 | /** 19 | * @var SelectionSet 20 | */ 21 | public $selectionSet; 22 | } -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/src/Language/AST/IntValue.php: -------------------------------------------------------------------------------- 1 | 10 | */ 11 | public $values; 12 | } 13 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/src/Language/AST/Location.php: -------------------------------------------------------------------------------- 1 | start = $start; 26 | $this->end = $end; 27 | $this->source = $source; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/src/Language/AST/Name.php: -------------------------------------------------------------------------------- 1 | _cloneValue($this); 93 | } 94 | 95 | private function _cloneValue($value) 96 | { 97 | if (is_array($value)) { 98 | $cloned = []; 99 | foreach ($value as $key => $arrValue) { 100 | $cloned[$key] = $this->_cloneValue($arrValue); 101 | } 102 | } else if ($value instanceof Node) { 103 | $cloned = clone $value; 104 | foreach (get_object_vars($cloned) as $prop => $propValue) { 105 | $cloned->{$prop} = $this->_cloneValue($propValue); 106 | } 107 | } else { 108 | $cloned = $value; 109 | } 110 | 111 | return $cloned; 112 | } 113 | 114 | /** 115 | * @return string 116 | */ 117 | public function __toString() 118 | { 119 | return json_encode($this); 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/src/Language/AST/NonNullType.php: -------------------------------------------------------------------------------- 1 | 10 | */ 11 | public $fields; 12 | } 13 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/src/Language/AST/OperationDefinition.php: -------------------------------------------------------------------------------- 1 | 23 | */ 24 | public $variableDefinitions; 25 | 26 | /** 27 | * @var array 28 | */ 29 | public $directives; 30 | 31 | /** 32 | * @var SelectionSet 33 | */ 34 | public $selectionSet; 35 | } 36 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/src/Language/AST/Selection.php: -------------------------------------------------------------------------------- 1 | 10 | */ 11 | public $selections; 12 | } 13 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/src/Language/AST/StringValue.php: -------------------------------------------------------------------------------- 1 | body = $body; 24 | $this->length = mb_strlen($body, 'UTF-8'); 25 | $this->name = $name ?: 'GraphQL'; 26 | } 27 | 28 | /** 29 | * @param $position 30 | * @return SourceLocation 31 | */ 32 | public function getLocation($position) 33 | { 34 | $line = 1; 35 | $column = $position + 1; 36 | 37 | $utfChars = json_decode('"\u2028\u2029"'); 38 | $lineRegexp = '/\r\n|[\n\r'.$utfChars.']/su'; 39 | $matches = array(); 40 | preg_match_all($lineRegexp, mb_substr($this->body, 0, $position, 'UTF-8'), $matches, PREG_OFFSET_CAPTURE); 41 | 42 | foreach ($matches[0] as $index => $match) { 43 | $line += 1; 44 | $column = $position + 1 - ($match[1] + mb_strlen($match[0], 'UTF-8')); 45 | } 46 | 47 | return new SourceLocation($line, $column); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/src/Language/SourceLocation.php: -------------------------------------------------------------------------------- 1 | line = $line; 12 | $this->column = $col; 13 | } 14 | 15 | public function toArray() 16 | { 17 | return [ 18 | 'line' => $this->line, 19 | 'column' => $this->column 20 | ]; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/src/Language/Token.php: -------------------------------------------------------------------------------- 1 | kind = $kind; 77 | $this->start = (int) $start; 78 | $this->end = (int) $end; 79 | $this->value = $value; 80 | } 81 | 82 | /** 83 | * @return string 84 | */ 85 | public function getDescription() 86 | { 87 | return self::getKindDescription($this->kind) . ($this->value ? ' "' . $this->value . '"' : ''); 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/src/SyntaxError.php: -------------------------------------------------------------------------------- 1 | getLocation($position); 17 | $syntaxError = 18 | "Syntax Error {$source->name} ({$location->line}:{$location->column}) $description\n\n" . 19 | self::highlightSourceAtLocation($source, $location); 20 | 21 | parent::__construct($syntaxError, null, null, $source, [$position]); 22 | } 23 | 24 | public static function highlightSourceAtLocation(Source $source, SourceLocation $location) 25 | { 26 | $line = $location->line; 27 | $prevLineNum = (string)($line - 1); 28 | $lineNum = (string)$line; 29 | $nextLineNum = (string)($line + 1); 30 | $padLen = mb_strlen($nextLineNum, 'UTF-8'); 31 | 32 | $unicodeChars = json_decode('"\u2028\u2029"'); // Quick hack to get js-compatible representation of these chars 33 | $lines = preg_split('/\r\n|[\n\r' . $unicodeChars . ']/su', $source->body); 34 | 35 | $lpad = function($len, $str) { 36 | return str_pad($str, $len - mb_strlen($str, 'UTF-8') + 1, ' ', STR_PAD_LEFT); 37 | }; 38 | 39 | return 40 | ($line >= 2 ? $lpad($padLen, $prevLineNum) . ': ' . $lines[$line - 2] . "\n" : '') . 41 | ($lpad($padLen, $lineNum) . ': ' . $lines[$line - 1] . "\n") . 42 | (str_repeat(' ', 1 + $padLen + $location->column) . "^\n") . 43 | ($line < count($lines) ? $lpad($padLen, $nextLineNum) . ': ' . $lines[$line] . "\n" : ''); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/src/Type/Definition/AbstractType.php: -------------------------------------------------------------------------------- 1 | 14 | */ 15 | public function getPossibleTypes(); 16 | 17 | /** 18 | * @return ObjectType 19 | */ 20 | public function getObjectType($value, ResolveInfo $info); 21 | 22 | /** 23 | * @param Type $type 24 | * @return bool 25 | */ 26 | public function isPossibleType(Type $type); 27 | } 28 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/src/Type/Definition/BooleanType.php: -------------------------------------------------------------------------------- 1 | value; 24 | } 25 | return null; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/src/Type/Definition/CompositeType.php: -------------------------------------------------------------------------------- 1 | new self([ 31 | 'name' => 'include', 32 | 'description' => 'Directs the executor to include this field or fragment only when the `if` argument is true.', 33 | 'args' => [ 34 | new FieldArgument([ 35 | 'name' => 'if', 36 | 'type' => Type::nonNull(Type::boolean()), 37 | 'description' => 'Included when true.' 38 | ]) 39 | ], 40 | 'onOperation' => false, 41 | 'onFragment' => true, 42 | 'onField' => true 43 | ]), 44 | 'skip' => new self([ 45 | 'name' => 'skip', 46 | 'description' => 'Directs the executor to skip this field or fragment when the `if` argument is true.', 47 | 'args' => [ 48 | new FieldArgument([ 49 | 'name' => 'if', 50 | 'type' => Type::nonNull(Type::boolean()), 51 | 'description' => 'Skipped when true' 52 | ]) 53 | ], 54 | 'onOperation' => false, 55 | 'onFragment' => true, 56 | 'onField' => true 57 | ]) 58 | ]; 59 | } 60 | return self::$internalDirectives; 61 | } 62 | 63 | /** 64 | * @var string 65 | */ 66 | public $name; 67 | 68 | /** 69 | * @var string|null 70 | */ 71 | public $description; 72 | 73 | /** 74 | * @var FieldArgument[] 75 | */ 76 | public $args; 77 | 78 | /** 79 | * @var boolean 80 | */ 81 | public $onOperation; 82 | 83 | /** 84 | * @var boolean 85 | */ 86 | public $onFragment; 87 | 88 | /** 89 | * @var boolean 90 | */ 91 | public $onField; 92 | 93 | public function __construct(array $config) 94 | { 95 | foreach ($config as $key => $value) { 96 | $this->{$key} = $value; 97 | } 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/src/Type/Definition/EnumValueDefinition.php: -------------------------------------------------------------------------------- 1 | $argConfig) { 41 | $map[] = new self($argConfig + ['name' => $name]); 42 | } 43 | return $map; 44 | } 45 | 46 | public function __construct(array $def) 47 | { 48 | foreach ($def as $key => $value) { 49 | $this->{$key} = $value; 50 | } 51 | } 52 | 53 | public function getType() 54 | { 55 | if (null === $this->resolvedType) { 56 | $this->resolvedType = Type::resolve($this->type); 57 | } 58 | return $this->resolvedType; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/src/Type/Definition/FloatType.php: -------------------------------------------------------------------------------- 1 | coerceFloat($value); 14 | } 15 | 16 | public function parseValue($value) 17 | { 18 | return $this->coerceFloat($value); 19 | } 20 | 21 | private function coerceFloat($value) 22 | { 23 | return is_numeric($value) || $value === true || $value === false ? (float) $value : null; 24 | } 25 | 26 | public function parseLiteral($ast) 27 | { 28 | if ($ast instanceof FloatValue || $ast instanceof IntValue) { 29 | return (float) $ast->value; 30 | } 31 | return null; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/src/Type/Definition/IDType.php: -------------------------------------------------------------------------------- 1 | value; 25 | } 26 | return null; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/src/Type/Definition/InputObjectField.php: -------------------------------------------------------------------------------- 1 | $v) { 31 | $this->{$k} = $v; 32 | } 33 | } 34 | 35 | public function getType() 36 | { 37 | return Type::resolve($this->type); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/src/Type/Definition/InputObjectType.php: -------------------------------------------------------------------------------- 1 | 10 | */ 11 | private $_fields; 12 | 13 | public $config; 14 | 15 | public function __construct(array $config) 16 | { 17 | Config::validate($config, [ 18 | 'name' => Config::STRING | Config::REQUIRED, 19 | 'fields' => Config::arrayOf([ 20 | 'name' => Config::STRING | Config::REQUIRED, 21 | 'type' => Config::INPUT_TYPE | Config::REQUIRED, 22 | 'defaultValue' => Config::ANY, 23 | 'description' => Config::STRING 24 | ], Config::KEY_AS_NAME | Config::MAYBE_THUNK), 25 | 'description' => Config::STRING 26 | ]); 27 | 28 | $this->config = $config; 29 | $this->name = $config['name']; 30 | $this->description = isset($config['description']) ? $config['description'] : null; 31 | } 32 | 33 | /** 34 | * @return InputObjectField[] 35 | */ 36 | public function getFields() 37 | { 38 | if (null === $this->_fields) { 39 | $this->_fields = []; 40 | $fields = isset($this->config['fields']) ? $this->config['fields'] : []; 41 | $fields = is_callable($fields) ? call_user_func($fields) : $fields; 42 | foreach ($fields as $name => $field) { 43 | $this->_fields[$name] = new InputObjectField($field + ['name' => $name]); 44 | } 45 | } 46 | 47 | return $this->_fields; 48 | } 49 | 50 | /** 51 | * @param string $name 52 | * @return InputObjectField 53 | * @throws \Exception 54 | */ 55 | public function getField($name) 56 | { 57 | if (null === $this->_fields) { 58 | $this->getFields(); 59 | } 60 | Utils::invariant(isset($this->_fields[$name]), "Field '%s' is not defined for type '%s'", $name, $this->name); 61 | return $this->_fields[$name]; 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/src/Type/Definition/InputType.php: -------------------------------------------------------------------------------- 1 | coerceInt($value); 14 | } 15 | 16 | public function parseValue($value) 17 | { 18 | return $this->coerceInt($value); 19 | } 20 | 21 | private function coerceInt($value) 22 | { 23 | if (false === $value || true === $value) { 24 | return (int) $value; 25 | } 26 | if (is_numeric($value) && $value <= PHP_INT_MAX && $value >= -1 * PHP_INT_MAX) { 27 | return (int) $value; 28 | } 29 | return null; 30 | } 31 | 32 | public function parseLiteral($ast) 33 | { 34 | if ($ast instanceof IntValue) { 35 | $val = (int) $ast->value; 36 | if ($ast->value === (string) $val) { 37 | return $val; 38 | } 39 | } 40 | return null; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/src/Type/Definition/LeafType.php: -------------------------------------------------------------------------------- 1 | ofType = $type; 25 | } 26 | 27 | /** 28 | * @return string 29 | */ 30 | public function toString() 31 | { 32 | $str = $this->ofType instanceof Type ? $this->ofType->toString() : (string) $this->ofType; 33 | return '[' . $str . ']'; 34 | } 35 | 36 | /** 37 | * @param bool $recurse 38 | * @return mixed 39 | */ 40 | public function getWrappedType($recurse = false) 41 | { 42 | $type = Type::resolve($this->ofType); 43 | return ($recurse && $type instanceof WrappingType) ? $type->getWrappedType($recurse) : $type; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/src/Type/Definition/NonNull.php: -------------------------------------------------------------------------------- 1 | ofType = $type; 29 | } 30 | 31 | /** 32 | * @param bool $recurse 33 | * @return Type 34 | * @throws \Exception 35 | */ 36 | public function getWrappedType($recurse = false) 37 | { 38 | $type = Type::resolve($this->ofType); 39 | 40 | Utils::invariant( 41 | !($type instanceof NonNull), 42 | 'Cannot nest NonNull inside NonNull' 43 | ); 44 | 45 | return ($recurse && $type instanceof WrappingType) ? $type->getWrappedType($recurse) : $type; 46 | } 47 | 48 | /** 49 | * @return string 50 | */ 51 | public function toString() 52 | { 53 | return $this->getWrappedType()->toString() . '!'; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/src/Type/Definition/OutputType.php: -------------------------------------------------------------------------------- 1 | name, 'Type must be named.'); 28 | } 29 | 30 | abstract public function serialize($value); 31 | 32 | abstract public function parseValue($value); 33 | 34 | abstract public function parseLiteral(/* GraphQL\Language\AST\Value */$valueAST); 35 | } 36 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/src/Type/Definition/StringType.php: -------------------------------------------------------------------------------- 1 | parseValue($value); 13 | } 14 | 15 | public function parseValue($value) 16 | { 17 | if ($value === true) { 18 | return 'true'; 19 | } 20 | if ($value === false) { 21 | return 'false'; 22 | } 23 | return (string) $value; 24 | } 25 | 26 | public function parseLiteral($ast) 27 | { 28 | if ($ast instanceof StringValue) { 29 | return $ast->value; 30 | } 31 | return null; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/src/Type/Definition/UnionType.php: -------------------------------------------------------------------------------- 1 | 10 | */ 11 | private $_types; 12 | 13 | /** 14 | * @var array 15 | */ 16 | private $_possibleTypeNames; 17 | 18 | /** 19 | * @var callback 20 | */ 21 | private $_resolveType; 22 | 23 | /** 24 | * @var array 25 | */ 26 | private $_config; 27 | 28 | public function __construct($config) 29 | { 30 | Config::validate($config, [ 31 | 'name' => Config::STRING | Config::REQUIRED, 32 | 'types' => Config::arrayOf(Config::OBJECT_TYPE, Config::MAYBE_THUNK | Config::REQUIRED), 33 | 'resolveType' => Config::CALLBACK, // function($value, ResolveInfo $info) => ObjectType 34 | 'description' => Config::STRING 35 | ]); 36 | 37 | Utils::invariant(!empty($config['types']), ""); 38 | 39 | /** 40 | * Optionally provide a custom type resolver function. If one is not provided, 41 | * the default implemenation will call `isTypeOf` on each implementing 42 | * Object type. 43 | */ 44 | $this->name = $config['name']; 45 | $this->description = isset($config['description']) ? $config['description'] : null; 46 | $this->_types = $config['types']; 47 | $this->_resolveType = isset($config['resolveType']) ? $config['resolveType'] : null; 48 | $this->_config = $config; 49 | } 50 | 51 | /** 52 | * @return array 53 | */ 54 | public function getPossibleTypes() 55 | { 56 | if ($this->_types instanceof \Closure) { 57 | $this->_types = call_user_func($this->_types); 58 | } 59 | return $this->_types; 60 | } 61 | 62 | /** 63 | * @param Type $type 64 | * @return mixed 65 | */ 66 | public function isPossibleType(Type $type) 67 | { 68 | if (!$type instanceof ObjectType) { 69 | return false; 70 | } 71 | 72 | if (null === $this->_possibleTypeNames) { 73 | $this->_possibleTypeNames = []; 74 | foreach ($this->getPossibleTypes() as $possibleType) { 75 | $this->_possibleTypeNames[$possibleType->name] = true; 76 | } 77 | } 78 | return isset($this->_possibleTypeNames[$type->name]); 79 | } 80 | 81 | /** 82 | * @param ObjectType $value 83 | * @param ResolveInfo $info 84 | * 85 | * @return Type 86 | * @throws \Exception 87 | */ 88 | public function getObjectType($value, ResolveInfo $info) 89 | { 90 | $resolver = $this->_resolveType; 91 | return $resolver ? call_user_func($resolver, $value, $info) : Type::getTypeOf($value, $info, $this); 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/src/Type/Definition/UnmodifiedType.php: -------------------------------------------------------------------------------- 1 | > 9 | */ 10 | private $_data; 11 | 12 | private $_wrappers = []; 13 | 14 | public function __construct() 15 | { 16 | $this->_data = new \SplObjectStorage(); // SplObject hash instead? 17 | } 18 | 19 | public function has($a, $b) 20 | { 21 | $a = $this->_toObj($a); 22 | $b = $this->_toObj($b); 23 | 24 | /** @var \SplObjectStorage $first */ 25 | $first = isset($this->_data[$a]) ? $this->_data[$a] : null; 26 | return isset($first, $first[$b]) ? $first[$b] : null; 27 | } 28 | 29 | public function add($a, $b) 30 | { 31 | $this->_pairSetAdd($a, $b); 32 | $this->_pairSetAdd($b, $a); 33 | } 34 | 35 | private function _toObj($var) 36 | { 37 | // SplObjectStorage expects objects, so wrapping non-objects to objects 38 | if (is_object($var)) { 39 | return $var; 40 | } 41 | if (!isset($this->_wrappers[$var])) { 42 | $tmp = new \stdClass(); 43 | $tmp->_internal = $var; 44 | $this->_wrappers[$var] = $tmp; 45 | } 46 | return $this->_wrappers[$var]; 47 | } 48 | 49 | private function _pairSetAdd($a, $b) 50 | { 51 | $a = $this->_toObj($a); 52 | $b = $this->_toObj($b); 53 | $set = isset($this->_data[$a]) ? $this->_data[$a] : null; 54 | 55 | if (!isset($set)) { 56 | $set = new \SplObjectStorage(); 57 | $this->_data[$a] = $set; 58 | } 59 | $set[$b] = true; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/src/Validator/Rules/ArgumentsOfCorrectType.php: -------------------------------------------------------------------------------- 1 | function(Argument $argAST) use ($context) { 28 | $argDef = $context->getArgument(); 29 | if ($argDef && !DocumentValidator::isValidLiteralValue($argAST->value, $argDef->getType())) { 30 | return new Error( 31 | self::badValueMessage($argAST->name->value, $argDef->getType(), Printer::doPrint($argAST->value)), 32 | [$argAST->value] 33 | ); 34 | } 35 | } 36 | ]; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/src/Validator/Rules/DefaultValuesOfCorrectType.php: -------------------------------------------------------------------------------- 1 | function(VariableDefinition $varDefAST) use ($context) { 20 | $name = $varDefAST->variable->name->value; 21 | $defaultValue = $varDefAST->defaultValue; 22 | $type = $context->getInputType(); 23 | 24 | if ($type instanceof NonNull && $defaultValue) { 25 | return new Error( 26 | Messages::defaultForNonNullArgMessage($name, $type, $type->getWrappedType()), 27 | [$defaultValue] 28 | ); 29 | } 30 | if ($type && $defaultValue && !DocumentValidator::isValidLiteralValue($defaultValue, $type)) { 31 | return new Error( 32 | Messages::badValueForDefaultArgMessage($name, $type, Printer::doPrint($defaultValue)), 33 | [$defaultValue] 34 | ); 35 | } 36 | return null; 37 | } 38 | ]; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/src/Validator/Rules/FieldsOnCorrectType.php: -------------------------------------------------------------------------------- 1 | function(Field $node) use ($context) { 17 | $type = $context->getParentType(); 18 | if ($type) { 19 | $fieldDef = $context->getFieldDef(); 20 | if (!$fieldDef) { 21 | return new Error( 22 | Messages::undefinedFieldMessage($node->name->value, $type->name), 23 | [$node] 24 | ); 25 | } 26 | } 27 | } 28 | ]; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/src/Validator/Rules/FragmentsOnCompositeTypes.php: -------------------------------------------------------------------------------- 1 | function(InlineFragment $node) use ($context) { 31 | $type = $context->getType(); 32 | 33 | if ($type && !Type::isCompositeType($type)) { 34 | return new Error( 35 | self::inlineFragmentOnNonCompositeErrorMessage($type), 36 | [$node->typeCondition] 37 | ); 38 | } 39 | }, 40 | Node::FRAGMENT_DEFINITION => function(FragmentDefinition $node) use ($context) { 41 | $type = $context->getType(); 42 | 43 | if ($type && !Type::isCompositeType($type)) { 44 | return new Error( 45 | self::fragmentOnNonCompositeErrorMessage($node->name->value, Printer::doPrint($node->typeCondition)), 46 | [$node->typeCondition] 47 | ); 48 | } 49 | } 50 | ]; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/src/Validator/Rules/KnownArgumentNames.php: -------------------------------------------------------------------------------- 1 | function(Argument $node, $key, $parent, $path, $ancestors) use ($context) { 28 | $argumentOf = $ancestors[count($ancestors) - 1]; 29 | if ($argumentOf->kind === Node::FIELD) { 30 | $fieldDef = $context->getFieldDef(); 31 | 32 | if ($fieldDef) { 33 | $fieldArgDef = null; 34 | foreach ($fieldDef->args as $arg) { 35 | if ($arg->name === $node->name->value) { 36 | $fieldArgDef = $arg; 37 | break; 38 | } 39 | } 40 | if (!$fieldArgDef) { 41 | $parentType = $context->getParentType(); 42 | Utils::invariant($parentType); 43 | return new Error( 44 | self::unknownArgMessage($node->name->value, $fieldDef->name, $parentType->name), 45 | [$node] 46 | ); 47 | } 48 | } 49 | } else if ($argumentOf->kind === Node::DIRECTIVE) { 50 | $directive = $context->getDirective(); 51 | if ($directive) { 52 | $directiveArgDef = null; 53 | foreach ($directive->args as $arg) { 54 | if ($arg->name === $node->name->value) { 55 | $directiveArgDef = $arg; 56 | break; 57 | } 58 | } 59 | if (!$directiveArgDef) { 60 | return new Error( 61 | self::unknownDirectiveArgMessage($node->name->value, $directive->name), 62 | [$node] 63 | ); 64 | } 65 | } 66 | } 67 | } 68 | ]; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/src/Validator/Rules/KnownDirectives.php: -------------------------------------------------------------------------------- 1 | function (Directive $node, $key, $parent, $path, $ancestors) use ($context) { 32 | $directiveDef = null; 33 | foreach ($context->getSchema()->getDirectives() as $def) { 34 | if ($def->name === $node->name->value) { 35 | $directiveDef = $def; 36 | break; 37 | } 38 | } 39 | 40 | if (!$directiveDef) { 41 | return new Error( 42 | self::unknownDirectiveMessage($node->name->value), 43 | [$node] 44 | ); 45 | } 46 | $appliedTo = $ancestors[count($ancestors) - 1]; 47 | 48 | if ($appliedTo instanceof OperationDefinition && !$directiveDef->onOperation) { 49 | return new Error( 50 | self::misplacedDirectiveMessage($node->name->value, 'operation'), 51 | [$node] 52 | ); 53 | } 54 | if ($appliedTo instanceof Field && !$directiveDef->onField) { 55 | return new Error( 56 | self::misplacedDirectiveMessage($node->name->value, 'field'), 57 | [$node] 58 | ); 59 | } 60 | 61 | $fragmentKind = ( 62 | $appliedTo instanceof FragmentSpread || 63 | $appliedTo instanceof InlineFragment || 64 | $appliedTo instanceof FragmentDefinition 65 | ); 66 | 67 | if ($fragmentKind && !$directiveDef->onFragment) { 68 | return new Error( 69 | self::misplacedDirectiveMessage($node->name->value, 'fragment'), 70 | [$node] 71 | ); 72 | } 73 | } 74 | ]; 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/src/Validator/Rules/KnownFragmentNames.php: -------------------------------------------------------------------------------- 1 | function(FragmentSpread $node) use ($context) { 21 | $fragmentName = $node->name->value; 22 | $fragment = $context->getFragment($fragmentName); 23 | if (!$fragment) { 24 | return new Error( 25 | self::unknownFragmentMessage($fragmentName), 26 | [$node->name] 27 | ); 28 | } 29 | } 30 | ]; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/src/Validator/Rules/KnownTypeNames.php: -------------------------------------------------------------------------------- 1 | function(NamedType $node, $key) use ($context) { 23 | if ($key === 'type' || $key === 'typeCondition') { 24 | $typeName = $node->name->value; 25 | $type = $context->getSchema()->getType($typeName); 26 | if (!$type) { 27 | return new Error(self::unknownTypeMessage($typeName), [$node]); 28 | } 29 | } 30 | } 31 | ]; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/src/Validator/Rules/NoUnusedFragments.php: -------------------------------------------------------------------------------- 1 | function() use (&$spreadNames, &$spreadsWithinOperation) { 28 | $spreadNames = new \stdClass(); 29 | $spreadsWithinOperation[] = $spreadNames; 30 | }, 31 | Node::FRAGMENT_DEFINITION => function(FragmentDefinition $def) use (&$fragmentDefs, &$spreadNames, &$fragAdjacencies) { 32 | $fragmentDefs[] = $def; 33 | $spreadNames = new \stdClass(); 34 | $fragAdjacencies->{$def->name->value} = $spreadNames; 35 | }, 36 | Node::FRAGMENT_SPREAD => function(FragmentSpread $spread) use (&$spreadNames) { 37 | $spreadNames->{$spread->name->value} = true; 38 | }, 39 | Node::DOCUMENT => [ 40 | 'leave' => function() use (&$fragAdjacencies, &$spreadsWithinOperation, &$fragmentDefs) { 41 | $fragmentNameUsed = []; 42 | 43 | foreach ($spreadsWithinOperation as $spreads) { 44 | $this->reduceSpreadFragments($spreads, $fragmentNameUsed, $fragAdjacencies); 45 | } 46 | 47 | $errors = []; 48 | foreach ($fragmentDefs as $def) { 49 | if (empty($fragmentNameUsed[$def->name->value])) { 50 | $errors[] = new Error( 51 | self::unusedFragMessage($def->name->value), 52 | [$def] 53 | ); 54 | } 55 | } 56 | return !empty($errors) ? $errors : null; 57 | } 58 | ] 59 | ]; 60 | } 61 | 62 | private function reduceSpreadFragments($spreads, &$fragmentNameUsed, &$fragAdjacencies) 63 | { 64 | foreach ($spreads as $fragName => $fragment) { 65 | if (empty($fragmentNameUsed[$fragName])) { 66 | $fragmentNameUsed[$fragName] = true; 67 | 68 | if (isset($fragAdjacencies->{$fragName})) { 69 | $this->reduceSpreadFragments( 70 | $fragAdjacencies->{$fragName}, 71 | $fragmentNameUsed, 72 | $fragAdjacencies 73 | ); 74 | } 75 | } 76 | } 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/src/Validator/Rules/NoUnusedVariables.php: -------------------------------------------------------------------------------- 1 | true, 27 | Node::OPERATION_DEFINITION => [ 28 | 'enter' => function() use (&$visitedFragmentNames, &$variableDefs, &$variableNameUsed) { 29 | $visitedFragmentNames = new \stdClass(); 30 | $variableDefs = []; 31 | $variableNameUsed = new \stdClass(); 32 | }, 33 | 'leave' => function() use (&$visitedFragmentNames, &$variableDefs, &$variableNameUsed) { 34 | $errors = []; 35 | foreach ($variableDefs as $def) { 36 | if (empty($variableNameUsed->{$def->variable->name->value})) { 37 | $errors[] = new Error( 38 | self::unusedVariableMessage($def->variable->name->value), 39 | [$def] 40 | ); 41 | } 42 | } 43 | return !empty($errors) ? $errors : null; 44 | } 45 | ], 46 | Node::VARIABLE_DEFINITION => function($def) use (&$variableDefs) { 47 | $variableDefs[] = $def; 48 | return Visitor::skipNode(); 49 | }, 50 | Node::VARIABLE => function($variable) use (&$variableNameUsed) { 51 | $variableNameUsed->{$variable->name->value} = true; 52 | }, 53 | Node::FRAGMENT_SPREAD => function($spreadAST) use (&$visitedFragmentNames) { 54 | // Only visit fragments of a particular name once per operation 55 | if (!empty($visitedFragmentNames->{$spreadAST->name->value})) { 56 | return Visitor::skipNode(); 57 | } 58 | $visitedFragmentNames->{$spreadAST->name->value} = true; 59 | } 60 | ]; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/src/Validator/Rules/ScalarLeafs.php: -------------------------------------------------------------------------------- 1 | function(Field $node) use ($context) { 28 | $type = $context->getType(); 29 | if ($type) { 30 | if (Type::isLeafType($type)) { 31 | if ($node->selectionSet) { 32 | return new Error( 33 | self::noSubselectionAllowedMessage($node->name->value, $type), 34 | [$node->selectionSet] 35 | ); 36 | } 37 | } else if (!$node->selectionSet) { 38 | return new Error( 39 | self::requiredSubselectionMessage($node->name->value, $type), 40 | [$node] 41 | ); 42 | } 43 | } 44 | } 45 | ]; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/src/Validator/Rules/VariablesAreInputTypes.php: -------------------------------------------------------------------------------- 1 | function(VariableDefinition $node) use ($context) { 25 | $type = Utils\TypeInfo::typeFromAST($context->getSchema(), $node->type); 26 | 27 | // If the variable type is not an input type, return an error. 28 | if ($type && !Type::isInputType($type)) { 29 | $variableName = $node->variable->name->value; 30 | return new Error( 31 | self::nonInputTypeOnVarMessage($variableName, Printer::doPrint($node->type)), 32 | [ $node->type ] 33 | ); 34 | } 35 | } 36 | ]; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/tests/Executor/ExecutionResultTest.php: -------------------------------------------------------------------------------- 1 | assertEquals(['data' => null], $executionResult->toArray()); 13 | } 14 | 15 | public function testToArrayExtensions() 16 | { 17 | $executionResult = new ExecutionResult(null, [], ['foo' => 'bar']); 18 | 19 | $this->assertEquals(['data' => null, 'extensions' => ['foo' => 'bar']], $executionResult->toArray()); 20 | 21 | $executionResult->extensions = ['bar' => 'foo']; 22 | 23 | $this->assertEquals(['data' => null, 'extensions' => ['bar' => 'foo']], $executionResult->toArray()); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/tests/Executor/TestClasses.php: -------------------------------------------------------------------------------- 1 | name = $name; 11 | $this->woofs = $woofs; 12 | } 13 | } 14 | 15 | class Cat 16 | { 17 | function __construct($name, $meows) 18 | { 19 | $this->name = $name; 20 | $this->meows = $meows; 21 | } 22 | } 23 | 24 | class Human 25 | { 26 | function __construct($name) 27 | { 28 | $this->name = $name; 29 | } 30 | } 31 | 32 | class Person 33 | { 34 | public $name; 35 | public $pets; 36 | public $friends; 37 | 38 | function __construct($name, $pets = null, $friends = null) 39 | { 40 | $this->name = $name; 41 | $this->pets = $pets; 42 | $this->friends = $friends; 43 | } 44 | } 45 | 46 | class ComplexScalar extends ScalarType 47 | { 48 | public static function create() 49 | { 50 | return new self(); 51 | } 52 | 53 | public $name = 'ComplexScalar'; 54 | 55 | public function serialize($value) 56 | { 57 | if ($value === 'DeserializedValue') { 58 | return 'SerializedValue'; 59 | } 60 | return null; 61 | } 62 | 63 | public function parseValue($value) 64 | { 65 | if ($value === 'SerializedValue') { 66 | return 'DeserializedValue'; 67 | } 68 | return null; 69 | } 70 | 71 | public function parseLiteral($valueAST) 72 | { 73 | if ($valueAST->value === 'SerializedValue') { 74 | return 'DeserializedValue'; 75 | } 76 | return null; 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/tests/Language/kitchen-sink.graphql: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2015, Facebook, Inc. 2 | # All rights reserved. 3 | # 4 | # This source code is licensed under the BSD-style license found in the 5 | # LICENSE file in the root directory of this source tree. An additional grant 6 | # of patent rights can be found in the PATENTS file in the same directory. 7 | 8 | query queryName($foo: ComplexType, $site: Site = MOBILE) { 9 | whoever123is: node(id: [123, 456]) { 10 | id , 11 | ... on User @defer { 12 | field2 { 13 | id , 14 | alias: field1(first:10, after:$foo,) @include(if: $foo) { 15 | id, 16 | ...frag 17 | } 18 | } 19 | } 20 | } 21 | } 22 | 23 | mutation likeStory { 24 | like(story: 123) @defer { 25 | story { 26 | id 27 | } 28 | } 29 | } 30 | 31 | fragment frag on Friend { 32 | foo(size: $size, bar: $b, obj: {key: "value"}) 33 | } 34 | 35 | { 36 | unnamed(truthy: true, falsey: false), 37 | query 38 | } 39 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/tests/Type/ScalarSerializationTest.php: -------------------------------------------------------------------------------- 1 | assertSame(1, $intType->serialize(1)); 13 | $this->assertSame(0, $intType->serialize(0)); 14 | $this->assertSame(0, $intType->serialize(0.1)); 15 | $this->assertSame(1, $intType->serialize(1.1)); 16 | $this->assertSame(-1, $intType->serialize(-1.1)); 17 | $this->assertSame(100000, $intType->serialize(1e5)); 18 | $this->assertSame(null, $intType->serialize(1e100)); 19 | $this->assertSame(null, $intType->serialize(-1e100)); 20 | $this->assertSame(-1, $intType->serialize('-1.1')); 21 | $this->assertSame(null, $intType->serialize('one')); 22 | $this->assertSame(0, $intType->serialize(false)); 23 | } 24 | 25 | public function testCoercesOutputFloat() 26 | { 27 | $floatType = Type::float(); 28 | 29 | $this->assertSame(1.0, $floatType->serialize(1)); 30 | $this->assertSame(-1.0, $floatType->serialize(-1)); 31 | $this->assertSame(0.1, $floatType->serialize(0.1)); 32 | $this->assertSame(1.1, $floatType->serialize(1.1)); 33 | $this->assertSame(-1.1, $floatType->serialize(-1.1)); 34 | $this->assertSame(null, $floatType->serialize('one')); 35 | $this->assertSame(0.0, $floatType->serialize(false)); 36 | $this->assertSame(1.0, $floatType->serialize(true)); 37 | } 38 | 39 | public function testCoercesOutputStrings() 40 | { 41 | $stringType = Type::string(); 42 | 43 | $this->assertSame('string', $stringType->serialize('string')); 44 | $this->assertSame('1', $stringType->serialize(1)); 45 | $this->assertSame('-1.1', $stringType->serialize(-1.1)); 46 | $this->assertSame('true', $stringType->serialize(true)); 47 | $this->assertSame('false', $stringType->serialize(false)); 48 | } 49 | 50 | public function testCoercesOutputBoolean() 51 | { 52 | $boolType = Type::boolean(); 53 | 54 | $this->assertSame(true, $boolType->serialize('string')); 55 | $this->assertSame(false, $boolType->serialize('')); 56 | $this->assertSame(true, $boolType->serialize(1)); 57 | $this->assertSame(false, $boolType->serialize(0)); 58 | $this->assertSame(true, $boolType->serialize(true)); 59 | $this->assertSame(false, $boolType->serialize(false)); 60 | 61 | // TODO: how should it behaive on '0'? 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/tests/Validator/AbstractQuerySecurityTest.php: -------------------------------------------------------------------------------- 1 | getRule(-1); 34 | } 35 | 36 | protected function createFormattedError($max, $count, $locations = []) 37 | { 38 | return FormattedError::create($this->getErrorMessage($max, $count), $locations); 39 | } 40 | 41 | protected function assertDocumentValidator($queryString, $max, array $expectedErrors = []) 42 | { 43 | $errors = DocumentValidator::validate( 44 | QuerySecuritySchema::buildSchema(), 45 | Parser::parse($queryString), 46 | [$this->getRule($max)] 47 | ); 48 | 49 | $this->assertEquals($expectedErrors, array_map(['GraphQL\Error', 'formatError'], $errors), $queryString); 50 | 51 | return $errors; 52 | } 53 | 54 | protected function assertIntrospectionQuery($maxExpected) 55 | { 56 | $query = Introspection::getIntrospectionQuery(true); 57 | 58 | $this->assertMaxValue($query, $maxExpected); 59 | } 60 | 61 | protected function assertIntrospectionTypeMetaFieldQuery($maxExpected) 62 | { 63 | $query = ' 64 | { 65 | __type(name: "Human") { 66 | name 67 | } 68 | } 69 | '; 70 | 71 | $this->assertMaxValue($query, $maxExpected); 72 | } 73 | 74 | protected function assertTypeNameMetaFieldQuery($maxExpected) 75 | { 76 | $query = ' 77 | { 78 | human { 79 | __typename 80 | firstName 81 | } 82 | } 83 | '; 84 | $this->assertMaxValue($query, $maxExpected); 85 | } 86 | 87 | protected function assertMaxValue($query, $maxExpected) 88 | { 89 | $this->assertDocumentValidator($query, $maxExpected); 90 | $newMax = $maxExpected - 1; 91 | if ($newMax !== AbstractQuerySecurity::DISABLED) { 92 | $this->assertDocumentValidator($query, $newMax, [$this->createFormattedError($newMax, $maxExpected)]); 93 | } 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/tests/Validator/FragmentsOnCompositeTypesTest.php: -------------------------------------------------------------------------------- 1 | expectPassesRule(new FragmentsOnCompositeTypes, ' 15 | fragment validFragment on Dog { 16 | barks 17 | } 18 | '); 19 | } 20 | 21 | public function testInterfaceIsValidFragmentType() 22 | { 23 | $this->expectPassesRule(new FragmentsOnCompositeTypes, ' 24 | fragment validFragment on Pet { 25 | name 26 | } 27 | '); 28 | } 29 | 30 | public function testObjectIsValidInlineFragmentType() 31 | { 32 | $this->expectPassesRule(new FragmentsOnCompositeTypes, ' 33 | fragment validFragment on Pet { 34 | ... on Dog { 35 | barks 36 | } 37 | } 38 | '); 39 | } 40 | 41 | public function testUnionIsValidFragmentType() 42 | { 43 | $this->expectPassesRule(new FragmentsOnCompositeTypes, ' 44 | fragment validFragment on CatOrDog { 45 | __typename 46 | } 47 | '); 48 | } 49 | 50 | public function testScalarIsInvalidFragmentType() 51 | { 52 | $this->expectFailsRule(new FragmentsOnCompositeTypes, ' 53 | fragment scalarFragment on Boolean { 54 | bad 55 | } 56 | ', 57 | [$this->error('scalarFragment', 'Boolean', 2, 34)]); 58 | } 59 | 60 | public function testEnumIsInvalidFragmentType() 61 | { 62 | $this->expectFailsRule(new FragmentsOnCompositeTypes, ' 63 | fragment scalarFragment on FurColor { 64 | bad 65 | } 66 | ', 67 | [$this->error('scalarFragment', 'FurColor', 2, 34)]); 68 | } 69 | 70 | public function testInputObjectIsInvalidFragmentType() 71 | { 72 | $this->expectFailsRule(new FragmentsOnCompositeTypes, ' 73 | fragment inputFragment on ComplexInput { 74 | stringField 75 | } 76 | ', 77 | [$this->error('inputFragment', 'ComplexInput', 2, 33)]); 78 | } 79 | 80 | public function testScalarIsInvalidInlineFragmentType() 81 | { 82 | $this->expectFailsRule(new FragmentsOnCompositeTypes, ' 83 | fragment invalidFragment on Pet { 84 | ... on String { 85 | barks 86 | } 87 | } 88 | ', 89 | [FormattedError::create( 90 | FragmentsOnCompositeTypes::inlineFragmentOnNonCompositeErrorMessage('String'), 91 | [new SourceLocation(3, 16)] 92 | )] 93 | ); 94 | } 95 | 96 | private function error($fragName, $typeName, $line, $column) 97 | { 98 | return FormattedError::create( 99 | FragmentsOnCompositeTypes::fragmentOnNonCompositeErrorMessage($fragName, $typeName), 100 | [ new SourceLocation($line, $column) ] 101 | ); 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/tests/Validator/KnownDirectivesTest.php: -------------------------------------------------------------------------------- 1 | expectPassesRule(new KnownDirectives, ' 14 | query Foo { 15 | name 16 | ...Frag 17 | } 18 | 19 | fragment Frag on Dog { 20 | name 21 | } 22 | '); 23 | } 24 | 25 | public function testWithKnownDirectives() 26 | { 27 | $this->expectPassesRule(new KnownDirectives, ' 28 | { 29 | dog @include(if: true) { 30 | name 31 | } 32 | human @skip(if: true) { 33 | name 34 | } 35 | } 36 | '); 37 | } 38 | 39 | public function testWithUnknownDirective() 40 | { 41 | $this->expectFailsRule(new KnownDirectives, ' 42 | { 43 | dog @unknown(directive: "value") { 44 | name 45 | } 46 | } 47 | ', [ 48 | $this->unknownDirective('unknown', 3, 13) 49 | ]); 50 | } 51 | 52 | public function testWithManyUnknownDirectives() 53 | { 54 | $this->expectFailsRule(new KnownDirectives, ' 55 | { 56 | dog @unknown(directive: "value") { 57 | name 58 | } 59 | human @unknown(directive: "value") { 60 | name 61 | pets @unknown(directive: "value") { 62 | name 63 | } 64 | } 65 | } 66 | ', [ 67 | $this->unknownDirective('unknown', 3, 13), 68 | $this->unknownDirective('unknown', 6, 15), 69 | $this->unknownDirective('unknown', 8, 16) 70 | ]); 71 | } 72 | 73 | public function testWithWellPlacedDirectives() 74 | { 75 | $this->expectPassesRule(new KnownDirectives, ' 76 | query Foo { 77 | name @include(if: true) 78 | ...Frag @include(if: true) 79 | skippedField @skip(if: true) 80 | ...SkippedFrag @skip(if: true) 81 | } 82 | '); 83 | } 84 | 85 | public function testWithMisplacedDirectives() 86 | { 87 | $this->expectFailsRule(new KnownDirectives, ' 88 | query Foo @include(if: true) { 89 | name 90 | ...Frag 91 | } 92 | ', [ 93 | $this->misplacedDirective('include', 'operation', 2, 17) 94 | ]); 95 | } 96 | 97 | private function unknownDirective($directiveName, $line, $column) 98 | { 99 | return FormattedError::create( 100 | KnownDirectives::unknownDirectiveMessage($directiveName), 101 | [ new SourceLocation($line, $column) ] 102 | ); 103 | } 104 | 105 | function misplacedDirective($directiveName, $placement, $line, $column) 106 | { 107 | return FormattedError::create( 108 | KnownDirectives::misplacedDirectiveMessage($directiveName, $placement), 109 | [new SourceLocation($line, $column)] 110 | ); 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/tests/Validator/KnownFragmentNamesTest.php: -------------------------------------------------------------------------------- 1 | expectPassesRule(new KnownFragmentNames, ' 15 | { 16 | human(id: 4) { 17 | ...HumanFields1 18 | ... on Human { 19 | ...HumanFields2 20 | } 21 | } 22 | } 23 | fragment HumanFields1 on Human { 24 | name 25 | ...HumanFields3 26 | } 27 | fragment HumanFields2 on Human { 28 | name 29 | } 30 | fragment HumanFields3 on Human { 31 | name 32 | } 33 | '); 34 | } 35 | 36 | public function testUnknownFragmentNamesAreInvalid() 37 | { 38 | $this->expectFailsRule(new KnownFragmentNames, ' 39 | { 40 | human(id: 4) { 41 | ...UnknownFragment1 42 | ... on Human { 43 | ...UnknownFragment2 44 | } 45 | } 46 | } 47 | fragment HumanFields on Human { 48 | name 49 | ...UnknownFragment3 50 | } 51 | ', [ 52 | $this->undefFrag('UnknownFragment1', 4, 14), 53 | $this->undefFrag('UnknownFragment2', 6, 16), 54 | $this->undefFrag('UnknownFragment3', 12, 12) 55 | ]); 56 | } 57 | 58 | private function undefFrag($fragName, $line, $column) 59 | { 60 | return FormattedError::create( 61 | KnownFragmentNames::unknownFragmentMessage($fragName), 62 | [new SourceLocation($line, $column)] 63 | ); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/tests/Validator/KnownTypeNamesTest.php: -------------------------------------------------------------------------------- 1 | expectPassesRule(new KnownTypeNames, ' 15 | query Foo($var: String, $required: [String!]!) { 16 | user(id: 4) { 17 | pets { ... on Pet { name }, ...PetFields } 18 | } 19 | } 20 | fragment PetFields on Pet { 21 | name 22 | } 23 | '); 24 | } 25 | 26 | public function testUnknownTypeNamesAreInvalid() 27 | { 28 | $this->expectFailsRule(new KnownTypeNames, ' 29 | query Foo($var: JumbledUpLetters) { 30 | user(id: 4) { 31 | name 32 | pets { ... on Badger { name }, ...PetFields } 33 | } 34 | } 35 | fragment PetFields on Peettt { 36 | name 37 | } 38 | ', [ 39 | $this->unknownType('JumbledUpLetters', 2, 23), 40 | $this->unknownType('Badger', 5, 25), 41 | $this->unknownType('Peettt', 8, 29) 42 | ]); 43 | } 44 | 45 | private function unknownType($typeName, $line, $column) 46 | { 47 | return FormattedError::create( 48 | KnownTypeNames::unknownTypeMessage($typeName), 49 | [new SourceLocation($line, $column)] 50 | ); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/tests/Validator/QuerySecuritySchema.php: -------------------------------------------------------------------------------- 1 | 'QueryRoot', 40 | 'fields' => [ 41 | 'human' => [ 42 | 'type' => self::buildHumanType(), 43 | 'args' => ['name' => ['type' => Type::string()]], 44 | ], 45 | ], 46 | ]); 47 | 48 | return self::$queryRootType; 49 | } 50 | 51 | public static function buildHumanType() 52 | { 53 | if (null !== self::$humanType) { 54 | return self::$humanType; 55 | } 56 | 57 | self::$humanType = new ObjectType( 58 | [ 59 | 'name' => 'Human', 60 | 'fields' => [ 61 | 'firstName' => ['type' => Type::nonNull(Type::string())], 62 | 'dogs' => [ 63 | 'type' => function () { 64 | return Type::nonNull( 65 | Type::listOf( 66 | Type::nonNull(self::buildDogType()) 67 | ) 68 | ); 69 | }, 70 | 'complexity' => function ($childrenComplexity, $args) { 71 | $complexity = isset($args['name']) ? 1 : 10; 72 | 73 | return $childrenComplexity + $complexity; 74 | }, 75 | 'args' => ['name' => ['type' => Type::string()]], 76 | ], 77 | ], 78 | ] 79 | ); 80 | 81 | return self::$humanType; 82 | } 83 | 84 | public static function buildDogType() 85 | { 86 | if (null !== self::$dogType) { 87 | return self::$dogType; 88 | } 89 | 90 | self::$dogType = new ObjectType( 91 | [ 92 | 'name' => 'Dog', 93 | 'fields' => [ 94 | 'name' => ['type' => Type::nonNull(Type::string())], 95 | 'master' => [ 96 | 'type' => self::buildHumanType(), 97 | ], 98 | ], 99 | ] 100 | ); 101 | 102 | return self::$dogType; 103 | } 104 | } 105 | -------------------------------------------------------------------------------- /Lib/webonyx/graphql-php/tests/Validator/VariablesAreInputTypesTest.php: -------------------------------------------------------------------------------- 1 | expectPassesRule(new VariablesAreInputTypes(), ' 14 | query Foo($a: String, $b: [Boolean!]!, $c: ComplexInput) { 15 | field(a: $a, b: $b, c: $c) 16 | } 17 | '); 18 | } 19 | 20 | public function testOutputTypesAreInvalid() 21 | { 22 | $this->expectFailsRule(new VariablesAreInputTypes, ' 23 | query Foo($a: Dog, $b: [[CatOrDog!]]!, $c: Pet) { 24 | field(a: $a, b: $b, c: $c) 25 | } 26 | ', [ 27 | FormattedError::create( 28 | VariablesAreInputTypes::nonInputTypeOnVarMessage('a', 'Dog'), 29 | [new SourceLocation(2, 21)] 30 | ), 31 | FormattedError::create( 32 | VariablesAreInputTypes::nonInputTypeOnVarMessage('b', '[[CatOrDog!]]!'), 33 | [new SourceLocation(2, 30)] 34 | ), 35 | FormattedError::create( 36 | VariablesAreInputTypes::nonInputTypeOnVarMessage('c', 'Pet'), 37 | [new SourceLocation(2, 50)] 38 | ) 39 | ] 40 | ); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # graphql-wp 2 | A simplified GraphQL endpoint for WordPress. 3 | Forked from Tim Field for my [vuewp](https://github.com/whuysmans/vuewp) project. 4 | 5 | You can find the original repo here: [graphql-wp](https://github.com/tim-field/graphql-wp). 6 | 7 | Here are some changes I made: 8 | 9 | ### Added a count result for pagination 10 | A 'count' result is returned with every response, like the 'X-WP-Total' header in the WP Rest Api. To get the number of posts in each response, the 'get_posts' method in WPQuery had to be replaced by WPQuery->query. 11 | 12 | ### Added acf response 13 | ACF response was added to WPPost. This still needs some work. 14 | 15 | ## Requires 16 | + php >= 5.6 17 | 18 | -------------------------------------------------------------------------------- /Schema.php: -------------------------------------------------------------------------------- 1 | 'Query', 64 | 'fields' => [ 65 | 'wp_query' => [ 66 | 'type' => WPQuery::getInstance(), 67 | 'resolve' => function($root, $args) { 68 | global $wp_query; 69 | return $wp_query; 70 | } 71 | ] 72 | ] 73 | ]); 74 | 75 | return $schema; 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /Type/Definition/Attachment.php: -------------------------------------------------------------------------------- 1 | [ 17 | 'type' => Type::string(), 18 | 'resolve' => function($post) { 19 | return wp_get_attachment_url($post->ID); 20 | } 21 | ], 22 | 'image_src' => [ 23 | 'type' => ImageSrc::getInstance(), 24 | 'args' => [ 25 | 'size' => ['type' => Type::string()], 26 | 'icon' => ['type' => Type::boolean()] 27 | ], 28 | 'resolve' => function($post, $args) { 29 | $args += [ 30 | 'size' => 'thumbnail', 31 | 'icon' => false, 32 | ]; 33 | extract($args); 34 | 35 | if($res = wp_get_attachment_image_src($post->ID, $size, $icon)){ 36 | return array_combine(['url','width','height','is_intermediate'],$res); 37 | } 38 | } 39 | ] 40 | ] + parent::getFieldSchema(); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Type/Definition/Author.php: -------------------------------------------------------------------------------- 1 | [ 19 | 'type'=>Type::string() 20 | ], 21 | 'display_name' => [ 22 | 'type' => Type::string() 23 | ], 24 | 'url' => [ 25 | 'type'=>Type::string() 26 | ], 27 | 'avatar' => [ 28 | 'type' => Type::string() 29 | ], 30 | 'id' => [ 31 | 'type' => Type::int() 32 | ] 33 | ]; 34 | } 35 | } -------------------------------------------------------------------------------- /Type/Definition/BlogInfo.php: -------------------------------------------------------------------------------- 1 | Type::string(), 'resolve' => function($filter, $args, $resolveInfo) { 18 | return get_bloginfo($resolveInfo->fieldName, isset($args['filter']) ?: $filter ); 19 | }]; 20 | 21 | return [ 22 | 'url' => $type, 23 | 'wpurl' => $type, 24 | 'description' => $type, 25 | 'rdf_url' => $type, 26 | 'rss_url' => $type, 27 | 'atom_url' => $type, 28 | 'comments_atom_url' => $type, 29 | 'comments_rss2_url' => $type, 30 | 'admin_email' => $type, 31 | 'blogname' => $type, 32 | ]; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Type/Definition/Category.php: -------------------------------------------------------------------------------- 1 | [ 19 | 'type' => Type::int() 20 | ], 21 | 'comment_post_ID' => [ 22 | 'type' => Type::int() 23 | ], 24 | 'comment_author' => [ 25 | 'type' => Type::string() 26 | ], 27 | 'comment_author_url' => [ 28 | 'type' => Type::string() 29 | ], 30 | 'comment_data' => [ 31 | 'type' => Type::string() 32 | ], 33 | 'comment_content' => [ 34 | 'type' => Type::string() 35 | ], 36 | 'comment_post_url' => [ 37 | 'type' => Type::string() 38 | ], 39 | 'comment_post_title' => [ 40 | 'type' => Type::string() 41 | ] 42 | ]; 43 | } 44 | } -------------------------------------------------------------------------------- /Type/Definition/HeaderVideo.php: -------------------------------------------------------------------------------- 1 | [ 19 | 'type' => Type::string() 20 | ], 21 | 'width' => [ 22 | 'type' => Type::int() 23 | ], 24 | 'height' => [ 25 | 'type' => Type::int() 26 | ] 27 | ]; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Type/Definition/ImageSrc.php: -------------------------------------------------------------------------------- 1 | ['type'=>Type::string()], 19 | 'width' => ['type'=>Type::string()], 20 | 'height' => ['type'=>Type::string()], 21 | 'is_intermediate' => ['type'=>Type::boolean()], 22 | ]; 23 | } 24 | 25 | static function getDescription() { 26 | return " A mime icon for files, thumbnail or intermediate size for images. 27 | see https://developer.wordpress.org/reference/functions/wp_get_attachment_image_src"; 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Type/Definition/MenuItem.php: -------------------------------------------------------------------------------- 1 | [ 24 | 'type' => Type::int(), 25 | 'description' => 'Database ID, different from object id', 26 | 'resolve' => function($item) { 27 | return $item->ID; 28 | } 29 | ], 30 | 'id' => [ 31 | 'type' => Type::int(), 32 | 'description' => 'Unique id for menu item', 33 | 'resolve' => function($item) { 34 | return $item->object_id; 35 | } 36 | ], 37 | 'caption' => [ 38 | 'type' => Type::string(), 39 | 'description' => 'File caption', 40 | 'resolve' => function($item) { 41 | return $item->caption; 42 | } 43 | ], 44 | 'title' => [ 45 | 'type' => Type::string(), 46 | 'description' => 'File title', 47 | 'resolve' => function($item) { 48 | return $item->title; 49 | } 50 | ], 51 | 'target' => [ 52 | 'type' => Type::string(), 53 | 'description' => 'Link target', 54 | 'resolve' => function($item) { 55 | return $item->target; 56 | } 57 | ], 58 | 'url' => [ 59 | 'type' => Type::string(), 60 | 'description' => 'Menu url', 61 | 'resolve' => function($item) { 62 | return $item->url; 63 | } 64 | ], 65 | 'description' => [ 66 | 'type' => Type::string(), 67 | 'description' => 'Link description', 68 | 'resolve' => function($item) { 69 | return $item->description; 70 | } 71 | ], 72 | 'classes' => [ 73 | 'type' => new ListOfType(Type::string()), 74 | 'description' => 'CSS class names for this item', 75 | 'resolve' => function($item) { 76 | return $item->classes; 77 | } 78 | ], 79 | 'parent' => [ 80 | 'type' => Type::int(), 81 | 'resolve' => function($item) { 82 | return $item->menu_item_parent; 83 | } 84 | ], 85 | 'guid' => [ 86 | 'type' => Type::string(), 87 | 'resolve' => function($item) { 88 | return $item->guid; 89 | } 90 | ] 91 | ]; 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /Type/Definition/Page.php: -------------------------------------------------------------------------------- 1 | 'PostStatus', 22 | 'description' => 'A valid post status', 23 | 'values' => [ 24 | 'publish' => [ 25 | 'value' => 'publish', 26 | 'description' => 'A published post or page' 27 | ], 28 | 'pending' => [ 29 | 'value' => 'pending', 30 | 'description' => 'post is pending review' 31 | ], 32 | 'draft' => [ 33 | 'value' => 'draft', 34 | 'description' => 'a post in draft status' 35 | ], 36 | 'autodraft' => [ 37 | 'name' => 'autodraft', 38 | 'value' => 'auto-draft', 39 | 'description' => 'a newly created post, with no content' 40 | ], 41 | 'future' => [ 42 | 'value' => 'future', 43 | 'description' => 'a post to publish in the future', 44 | ], 45 | 'private' => [ 46 | 'value' => 'private', 47 | 'description' => 'not visible to users who are not logged in' 48 | ], 49 | 'inherit' => [ 50 | 'value' => 'inherit', 51 | 'description' => 'a revision.' 52 | ], 53 | 'trash' => [ 54 | 'value' => 'trash', 55 | 'description' => 'post is in trashbin' 56 | ] 57 | ] 58 | ],$config)); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /Type/Definition/PostType.php: -------------------------------------------------------------------------------- 1 | [ 15 | 'type' => static::getWPQuery(), 16 | 'resolve' => function($root, $args) { 17 | global $wp_query; 18 | return $wp_query; 19 | } 20 | ] 21 | ]; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Type/Definition/Tag.php: -------------------------------------------------------------------------------- 1 | [get_called_class(), 'resolveType'] 14 | ],$config)); 15 | } 16 | 17 | abstract static function resolveType($obj); 18 | } 19 | -------------------------------------------------------------------------------- /Type/Definition/WPObjectType.php: -------------------------------------------------------------------------------- 1 | function() { 19 | return static::getSchemaInterfaces(); 20 | } 21 | ],$config)); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Type/Definition/WPSchema.php: -------------------------------------------------------------------------------- 1 | static::getName(), 22 | 'description' => static::getDescription(), 23 | 'fields' => static::getFieldSchema(), 24 | ],$config)); 25 | } 26 | 27 | static function getName() { 28 | return (new \ReflectionClass(get_called_class()))->getShortName(); 29 | } 30 | 31 | static function getDescription() { 32 | return null; 33 | } 34 | 35 | static function getType() { 36 | return (string) s(static::getName())->underscored(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ci/graphql-wp", 3 | "description": "A simplified GraphQL endpoint for WordPress", 4 | "type" : "wordpress-plugin", 5 | "license": "GPL", 6 | "authors": [ 7 | { 8 | "name": "Werner Huysmans", 9 | "email": "werner.huysmans@gmail.com" 10 | } 11 | ], 12 | "config": { 13 | "vendor-dir": "Lib" 14 | }, 15 | "require": { 16 | "php": ">=5.6", 17 | "mohiohio/wordpress-lib":"^0.1", 18 | "webonyx/graphql-php": "^v0.6", 19 | "ivome/graphql-relay-php": "^0.1.2", 20 | "danielstjules/stringy": "^2.3" 21 | }, 22 | "autoload": { 23 | "psr-4": { 24 | "CI\\GraphQLWP\\":"" 25 | } 26 | }, 27 | "require-dev": { 28 | "analog/analog": "^1.0" 29 | } 30 | } 31 | --------------------------------------------------------------------------------