Ejemplo n.º 1
0
function px_verifiy_options_page()
{
    $result = '';
    if (isset($_GET['action']) && $_GET['action'] == 'refreshEnvatoData') {
        $result = px_verify_refresh_envato_data($user_id);
    } else {
        if (isset($_GET['action']) && $_GET['action'] == 'upgradeAqua') {
            $result = px_verify_upgrade_aqua($user_id);
        }
    }
    ?>
	<form action='options.php' method='post'>
		<h2>Pixelart Verifier</h2>
		<?php 
    settings_fields('Pixelart Verifier');
    do_settings_sections('Pixelart Verifier');
    submit_button();
    ?>
	</form>	
	<?php 
}
Ejemplo n.º 2
0
function px_verifier_bulk_actions()
{
    $wp_list_table = _get_list_table('WP_Users_List_Table');
    $action = $wp_list_table->current_action();
    $refreshed = array();
    switch ($action) {
        case 'refresh_envato_data':
            echo 'ok';
            foreach ($userids as $id) {
                $result = px_verify_refresh_envato_data($id);
                if ($result == '<div id="message" class="updated notice is-dismissible"><p><strong>Refreshed successfully!</strong></p></div>') {
                    $refreshed[$id] = 'updated';
                } else {
                    $result = str_replace('<div id="message" class="error notice is-dismissible"><p>', '', $result);
                    $result = str_replace('</p></div>', '', $result);
                    $refreshed[$id] = $result;
                }
            }
            break;
        case 'upgrade_aqua':
            foreach ($userids as $id) {
                $result = px_verify_upgrade_aqua($id);
                if ($result == '<div id="message" class="updated notice is-dismissible"><p><strong>Upgraded the data from Aqua Verifier!</strong></p></div>') {
                    $refreshed[$id] = 'upgraded';
                } else {
                    $result = str_replace('<div id="message" class="error notice is-dismissible"><p>', '', $result);
                    $result = str_replace('</p></div>', '', $result);
                    $refreshed[$id] = $result;
                }
            }
            break;
    }
    $msg;
    foreach ($refreshed as $key => $value) {
        $msg = '<p><strong>' . $key . ':</strong> ' . $value . '</p>';
    }
    var_dump($msg);
    $sendback = add_query_arg('px_verifier', $msg, $sendback);
    wp_redirect($sendback);
}
Ejemplo n.º 3
0
function px_verifier_bulk_refresh_envato_data()
{
    $users = get_users();
    $refreshed = array();
    foreach ($users as $user) {
        $id = $user->id;
        $result = px_verify_refresh_envato_data($id);
        if ($result == '<div id="message" class="updated notice is-dismissible"><p><strong>Refreshed successfully!</strong></p></div>') {
            $refreshed[$id] = 'ok';
        } else {
            $result = str_replace('<div id="message" class="error notice is-dismissible"><p>', '', $result);
            $result = str_replace('</p></div>', '', $result);
            $refreshed[$id] = $result;
        }
    }
    $msg;
    foreach ($refreshed as $key => $value) {
        $msg .= '<p><strong>' . $key . ':</strong> ' . $value . '</p>';
    }
    //	var_dump($msg);
    $sendback = add_query_arg('px_verifier', urlencode($msg), $sendback);
    wp_redirect($sendback);
}
Ejemplo n.º 4
0
/** The user page side functions **/
function px_verify_show_extra_profile_fields($user)
{
    $user_id = $user->ID;
    $result;
    if (isset($_GET['action']) && $_GET['action'] == 'refreshEnvatoData') {
        $result = px_verify_refresh_envato_data($user_id);
    } else {
        if (isset($_GET['action']) && $_GET['action'] == 'upgradeAqua') {
            $result = px_verify_upgrade_aqua($user_id);
        } else {
            $result = '';
        }
    }
    ?>
	
	<h3>Envato User Information</h3>

	<table class="form-table">
		<tr>
			<th>
				<label for="px_envato_purchase_code">Purchase Code</label>
			</th>
			<td>
				<input type="text" name="px_envato_purchase_code" id="px_envato_purchase_code" value="<?php 
    echo esc_attr(get_the_author_meta('px_envato_purchase_code', $user_id));
    ?>
" class="regular-text" /><br />
			</td>
		</tr>
		
		<tr>
			<th>
				<label for="px_envato_username">Envato Username</label>
			</th>
			<td>
				<input type="text" name="px_envato_username" id="px_envato_username" value="<?php 
    echo esc_attr(get_the_author_meta('px_envato_username', $user_id));
    ?>
" class="regular-text"  readonly /><br />
			</td>
		</tr>
		
		<tr>
			<th>
				<label for="px_envato_purchase_date">Purchase Date</label>
			</th>
			<td>
				<input type="text" name="px_envato_purchase_date" id="px_envato_purchase_date" value="<?php 
    echo esc_attr(get_the_author_meta('px_envato_purchase_date', $user_id));
    ?>
" class="regular-text"  readonly /><br />
			</td>
		</tr>
		
		<tr>
			<th>
				<label for="px_envato_item">Item Name</label>
			</th>
			<td>
				<input type="text" name="px_envato_item" id="px_envato_item" value="<?php 
    echo esc_attr(get_the_author_meta('px_envato_item', $user_id));
    ?>
" class="regular-text"  readonly /><br />
			</td>
		</tr>
		
		<tr>
			<th>
				<label for="px_envato_license">License</label>
			</th>
			<td>
				<input type="text" name="px_envato_license" id="px_envato_license" value="<?php 
    echo esc_attr(get_the_author_meta('px_envato_license', $user_id));
    ?>
" class="regular-text"  readonly /><br />
			</td>
		</tr>
		
		<tr>
			<th>
				<label for="px_envato_support_amount">Support Amount</label>
			</th>
			<td>
				<input type="text" name="px_envato_support_amount" id="px_envato_support_amount" value="<?php 
    echo esc_attr(get_the_author_meta('px_envato_support_amount', $user_id));
    ?>
" class="regular-text"  readonly /><br />
			</td>
		</tr>
		
		<tr>
			<th>
				<label for="px_envato_support_until">Support Until</label>
			</th>
			<td>
				<input type="text" name="px_envato_support_until" id="px_envato_support_until" value="<?php 
    echo esc_attr(get_the_author_meta('px_envato_support_until', $user_id));
    ?>
" class="regular-text"  readonly /><br />
			</td>
		</tr>
		
		<tr>
			<th>
			</th>
			<td>
				<a href="?user_id=<?php 
    echo $user_id;
    ?>
&action=refreshEnvatoData" class="button" >Refresh Envato Data</a>
				<a href="?user_id=<?php 
    echo $user_id;
    ?>
&action=upgradeAqua" class="button" >Upgrade from Aqua Verifier</a>
				<?php 
    echo $result;
    ?>
			</td>
		</tr>
	</table>
	
<?php 
}