This file contains 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 | |
class My_Table { | |
.... | |
public function uninstall() { | |
global $wpdb; | |
$wpdb->query("DROP TABLE IF EXISTS $this->table_name"); | |
} | |
} |
This file contains 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 | |
class My_Table { | |
protected $table_version; | |
protected $table_name; | |
... | |
public function run() { | |
$this->init(); | |
//call the functions to update version here. |
This file contains 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 | |
class My_Table { | |
protected $table_version; | |
protected $table_name; | |
public function __contruct() { | |
global $wpdb; | |
$this->db_version = get_option('my_table_version') === false ? '1.0' : get_option('my_table_version'); | |
$this->table_name = $wpdb->prefix . 'my_table'; | |
} |
This file contains 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 | |
... | |
register_activation_hook( __FILE__, 'activate_my_plugin' ); | |
function activate_my_plugin() { | |
$db = new My_Table(); | |
$db->run(); | |
} | |
... |
This file contains 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 | |
use Aws\S3\S3Client; | |
if ( ! class_exists( 'S3_Service' ) ) { | |
/** | |
* Class SSU_S3_Service | |
*/ | |
class S3_Service { | |
/** | |
* S3 class |
This file contains 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
version: 2 | |
jobs: | |
build: | |
docker: | |
- image: circleci/node:8.10 | |
working_directory: ~/lambda_func | |
steps: | |
- checkout |
This file contains 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_filter('the_content', 'pda_convert_img_to_fast_img', 10 ); | |
/** | |
* Convert img tag to fast-img tag in the post's content | |
* @param $content The post's content | |
* | |
* @return mixed The massage content | |
*/ |
This file contains 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 | |
if ( class_exists( 'PDA_Private_Link_Services' ) ) { | |
//669 is attachment's id. | |
return PDA_Private_Link_Services::create_private_link( 669, array( | |
'expired_days' => 5, | |
'limit_downloads' => 3, | |
) ); | |
} |
This file contains 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 | |
if ( class_exists( 'PDA_Private_Link_Services' ) ) { | |
//669 is attachment's id. | |
$result = PDA_Private_Link_Services::protect_file( 669 ); | |
if ( is_wp_error( $result ) ) { | |
echo $result->get_error_message(); | |
} | |
} |
This file contains 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 handle_pda_before_sending_file_hook( $server_data, $link_data ) { | |
//Write code to handle data here | |
} | |
add_action( 'PDA_HOOK_BEFORE_SENDING_FILE', 'handle_pda_before_sending_file_hook', 10, 2 ); | |
?> |