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
[\((][\s\S]*[\))] |
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 id="views">views!!!begin!!! | |
<?php | |
print views_embed_view('foodbanks', 'block', $state); | |
?> | |
<a href="##" id= "freash" >freash!!!</a> | |
<script type="text/javascript"> | |
(function($) { | |
function getInfo(args) { | |
$.ajax({ |
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
module_load_include('inc', 'block', 'block.admin'); | |
global $theme_key; | |
$blocks = block_admin_display_prepare_blocks($theme_key); | |
foreach ($blocks as $key => $block) { | |
if($block['info']=='Social Views txt3') $block_delta1=$block['delta']; | |
if($block['info']=='Social Views txt4') $block_delta2=$block['delta']; | |
} | |
$block_text1 = module_invoke('block', 'block_view', $block_delta1); | |
$block_text2 = module_invoke('block', 'block_view', $block_delta2); |
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(); |
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
<!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
<?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
<?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
//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
$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& |