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
(function ($) { | |
Drupal.behaviors.confirm = { | |
attach: function(context, settings) { | |
var events = $('.node-weibo-form input[name=op]').data('events'); // Get the jQuery events. | |
$('.node-weibo-form input[name=op]').unbind('mousedown'); // Remove the click events. | |
var name = $('.node-weibo-form input[name=title]').val(); | |
$('.node-weibo-form input[name=op]').mousedown(function () { | |
// var events = $('.node-weibo-form input[name=op]').clone(true).data('events');// Get the jQuery events. |
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
<div class="contact_card" id="contact_card_guo" style="display:none; position:relative; z-index:99999;"> | |
<div class="box" id="guo-hide"> | |
<div id="guo-show"> | |
<p><b class="f20"><?php print t("You need to be logged in order to submit your enquiry.");?></b></p> | |
<div class="btn_login"><a href="<?php print url('user/register');?>" class="btn_orange"><?php print t('Sign up, it\'s free');?></a></div> | |
<div class="btn_login"><a href="#TB_inline?height=360&width=420&inlineId=loginbox" class="btn_orange thickbox"><?php print t('Login');?></a></div> | |
<div id="contact_card_guo_close"><a href="#" id="TB_closeWindowButton">close</a></div> | |
</div> | |
</div> |
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
<script type="text/javascript"> | |
$(document).ready(function(){ | |
$("#webform-client-form-1363 .form-actions .form-radios label").live('click',function(e){//.click(function(){ | |
e.preventDefault(); | |
$(this).children('input').attr('checked','checked'); | |
// console.log('click'); | |
$("#webform-client-form-1363 .form-actions input[type=submit]").trigger("click"); | |
}); | |
}) | |
</script> |
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
$books = array( | |
'0'=>'http://mp.weixin.qq.com/mp/appmsg/show?__biz=MjM5NjQwMDE2Mw==&appmsgid=10000251&itemidx=1&sign=52b2980fca36785ca3671575fa1cb098#wechat_redirect', | |
'1'=>'http://mp.weixin.qq.com/mp/appmsg/show?__biz=MjM5NjQwMDE2Mw==&appmsgid=10000251&itemidx=2&sign=b7e8cc04c531fc07a953d39c62411c08#wechat_redirect', | |
'2'=>'http://mp.weixin.qq.com/mp/appmsg/show?__biz=MjM5NjQwMDE2Mw==&appmsgid=10000251&itemidx=3&sign=df465908982990d92306ac649b9a663e#wechat_redirect', | |
'3'=>'http://mp.weixin.qq.com/mp/appmsg/show?__biz=MjM5NjQwMDE2Mw==&appmsgid=10000251&itemidx=4&sign=7d98347febbe2707d887f49bf8cddfff#wechat_redirect', | |
'4'=>'http://mp.weixin.qq.com/mp/appmsg/show?__biz=MjM5NjQwMDE2Mw==&appmsgid=10000251&itemidx=5&sign=547baf5c8b15297f80b4737a04f9ccf7#wechat_redirect', | |
'5'=>'http://mp.weixin.qq.com/mp/appmsg/show?__biz=MjM5NjQwMDE2Mw==&appmsgid=10000251&itemidx=6&sign=e7e45471b60e5ab7a0624f8b99b2e3a6#wechat_redirect', | |
'6'=>'http://mp.weixin.qq.com/mp/appmsg/show?__biz=MjM5NjQwMDE2Mw==&appmsgid=10000251&itemidx=7& |
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
//https://www.drupal.org/project/jcrop_form_element | |
/** | |
* Implements hook_form_alter(). | |
*/ | |
function jcrop_fapi_form_alter(&$form, &$form_state, $form_id) { | |
$form['picture']['picture_upload']['#type'] = 'jcrop_image'; | |
$libraries = libraries_load('jcrop', $variant = NULL); | |
libraries_load_files($libraries); | |
array_unshift($form['#submit'], 'jcrop_form_submit'); | |
} |
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 | |
/** | |
* 需求:User can register using email and user name, then log in later after receiving the validation email. All the users share the same avatar. | |
* 即 邮箱验证前禁止注册用户登陆 | |
* 本需求可以使用Pie Register的验证link 并参照 http://wordpress.org/plugins/wp-members/ 的 wp-members-core.php 代码 进行实现 | |
* Step 1: Enable plugin Pie Register http://wordpress.org/plugins/pie-register/ | |
* Step 2: Go Pie Register -> General Settings (wp-admin/admin.php?page=pie-general-settings) set User Verification => Email Verification. | |
* Step 3: Add flow code in your theme functions.php | |
*/ | |
/** initialize **/ |
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 | |
// Method to handle comment submission | |
function ajaxComment($comment_ID, $comment_status) { | |
// If it's an AJAX-submitted comment | |
if(isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest'){ | |
// Get the comment data | |
$comment = get_comment($comment_ID); | |
// Allow the email to the author to be sent | |
wp_notify_postauthor($comment_ID, $comment->comment_type); | |
// Get the comment HTML from my custom comment HTML function |
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
<!DOCTYPE html> | |
<html lang="zh-cn"> | |
<head> | |
<meta charset="utf-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
<title>Multiple cURL Requests with PHP</title> | |
<!-- Bootstrap --> | |
<link rel="stylesheet" href="http://cdn.bootcss.com/bootstrap/3.3.2/css/bootstrap.min.css"> |
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
//正则表达式获取URL参数 preg get URL parameter | |
//http://stackoverflow.com/questions/11706986/php-getting-url-variable-with-preg-match | |
$subject = "http://www.mysite.com?id=05&name=johnny"; | |
$pattern = '/id=[0-9A-Za-z]*/'; //$pattern = '/id=[0-9]*/'; if it is only numeric. | |
preg_match($pattern, $subject, $matches); | |
print_r($matches); |
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
/** | |
* Geolocation | |
*/ | |
$ip = $_SERVER['REMOTE_ADDR']; | |
$result = db_select('ip_geolocation', 'g') | |
->fields('g') | |
->condition('ip', $ip, '=') | |
->execute() | |
->fetchAssoc(); |