This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function my_igp_post_title( $title ) { | |
// "car model:", "engine:", "Country & City: and (no. 40)" ie.: | |
// Title: BMW E46 - M52 - Germany/Bavaria/Hof (no. 40) | |
$model = trim( get_string_between( $title, 'car model:', 'engine:' ) ); | |
$engine = trim( get_string_between( $title, 'engine:', 'bhp:' ) ); | |
$country = trim( get_string_between( $title, 'country & city:', 'occupation:' ) ); | |
$number = '(no. ' . trim( get_string_between( $title, ' (no.', ')' ) ) . ')'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'plugins_loaded', function () { | |
/** | |
* Submission class extension so we can access the protected errors property. | |
* | |
* Class NF_FU_AJAX_Controllers_Submission | |
*/ | |
class NF_FU_AJAX_Controllers_Submission extends NF_AJAX_Controllers_Submission { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$I->waitForText( 'Sign in to Dropbox' ); | |
$I->fillField( 'login_email', $_ENV['DROPBOX_EMAIL'] ); | |
$I->wait( 1 ); | |
$I->fillField( 'login_password', $_ENV['DROPBOX_PASSWORD'] ); | |
$I->click( [ 'class' => 'login-button' ] ); | |
$I->wait( 10 ); | |
if ( $I->seeOnPage( 'Allow' ) ) { | |
$I->click( 'Allow' ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$I->waitForText( 'Sign in with Google' ); | |
$I->fillField('#identifierId', $_ENV['GOOGLE_EMAIL']); | |
$I->wait(1); | |
$I->click('#identifierNext'); | |
$I->wait(1); | |
$I->fillField('password', $_ENV['GOOGLE_PASSWORD']); | |
$I->wait(1); | |
$I->click('#passwordNext'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# replace 'file' with the array key you want to extract | |
SELECT | |
SUBSTRING_INDEX( | |
SUBSTRING_INDEX( | |
SUBSTRING(pm.meta_value, ( INSTR( pm.meta_value, CONCAT( 'file', '";' ) ) + CHAR_LENGTH( 'file') + 1 ) ), | |
'"', 2 ), | |
'"', -1 ) as attachment_file | |
FROM wp_posts p | |
INNER JOIN wp_postmeta pm | |
ON p.ID = pm.post_id |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$prefix = 'igp'; | |
$panel = new \TDP\OptionsKit( $prefix ); | |
$panel->set_page_title( __( 'My Plugin Settings' ) ); | |
/** | |
* Setup the menu for the options panel. | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Generated by the WordPress Option Page generator | |
* at http://jeremyhixon.com/wp-tools/option-page/ | |
*/ | |
class MyExamplePlugin { | |
private $my_example_plugin_options; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'add_post_meta', function ( $object_id, $meta_key, $_meta_value ) { | |
if ( $meta_key !== '_igp_id' ) { | |
return; | |
} | |
$category_id = 11; // Change this to the tag_id | |
wp_set_post_categories( $object_id, array( $category_id ) ); | |
}, 10, 3 ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Make sure the Composer\Autoload namespace is prefixed. | |
* Needs to be run after php-scoper. | |
* | |
* `php ./patch-scoper-autoloader-namespace.php MY_PREFIX` | |
*/ | |
if ( empty( $argv[1] ) ) { | |
return; |