| 1 |
<?php |
| 2 |
/* |
| 3 |
Plugin Name: MembershipWorks - Membership, Events & Directory |
| 4 |
Plugin URI: https://membershipworks.com |
| 5 |
Description: Membership Works plugin |
| 6 |
Version: 6.16.1 |
| 7 |
Author: MembershipWorks |
| 8 |
Author URI: https://membershipworks.com |
| 9 |
License: GPL2 |
| 10 |
*/ |
| 11 |
|
| 12 |
/* Copyright 2013-2026 MembershipWorks (email : info@membershipworks.com) |
| 13 |
|
| 14 |
This program is free software; you can redistribute it and/or modify |
| 15 |
it under the terms of the GNU General Public License, version 2, as |
| 16 |
published by the Free Software Foundation. |
| 17 |
|
| 18 |
This program is distributed in the hope that it will be useful, |
| 19 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 20 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 21 |
GNU General Public License for more details. |
| 22 |
|
| 23 |
You should have received a copy of the GNU General Public License |
| 24 |
along with this program; if not, write to the Free Software |
| 25 |
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 26 |
*/ |
| 27 |
|
| 28 |
$SF_widgetid=0; |
| 29 |
$SF_member_account=false; |
| 30 |
$SF_member_labels=array(); |
| 31 |
$SF_member_folders=array(); |
| 32 |
$SF_page_data=false; |
| 33 |
$SF_enqueue_css=false; |
| 34 |
|
| 35 |
function sf_api($con,$act,$fn,$param) { |
| 36 |
if (!empty($_SERVER['HTTP_USER_AGENT'])&&preg_match("/yandex/i",$_SERVER['HTTP_USER_AGENT'])>0) |
| 37 |
return array('error'=>'Blocked'); |
| 38 |
if ($act!='GET') |
| 39 |
return array('error'=>'Not supported'); |
| 40 |
$q=array(); |
| 41 |
foreach($param as $k=>$v) { |
| 42 |
if (is_array($v)) { |
| 43 |
foreach($v as $i=>$x) $v[$i]=urlencode($x); |
| 44 |
$q[]=$k.'='.implode(',',$v); |
| 45 |
} else { |
| 46 |
$q[]=$k.'='.urlencode($v); |
| 47 |
} |
| 48 |
} |
| 49 |
//$ctx=stream_context_create(array('http'=>array('method'=>'GET','header'=>"From: ".(isset($_SERVER['HTTP_X_FORWARDED_FOR'])?$_SERVER['HTTP_X_FORWARDED_FOR']:$_SERVER['REMOTE_ADDR']),'user_agent'=>$_SERVER['HTTP_USER_AGENT']))); |
| 50 |
//$rsp=file_get_contents($con.'://api.membershipworks.com/'.$fn.'?'.implode('&',$q),false,$ctx); |
| 51 |
//if (empty($rsp)) |
| 52 |
// return array('error'=>'No response'); |
| 53 |
//else |
| 54 |
// return json_decode($rsp,true); |
| 55 |
$args=array('headers'=>array('from'=>isset($_SERVER['HTTP_X_FORWARDED_FOR'])?$_SERVER['HTTP_X_FORWARDED_FOR']:$_SERVER['REMOTE_ADDR']),'user-agent'=>$_SERVER['HTTP_USER_AGENT']); |
| 56 |
for($try=0;$try<3;$try++) { |
| 57 |
$rsp=wp_remote_get($con.'://api.membershipworks.com/'.$fn.'?'.implode('&',$q),$args); |
| 58 |
if (is_wp_error($rsp)) usleep(100000); else break; |
| 59 |
} |
| 60 |
if (is_wp_error($rsp)) |
| 61 |
return array('error'=>$rsp->get_error_message()); |
| 62 |
else if (empty($rsp['body'])) |
| 63 |
return array('error'=>'No response'); |
| 64 |
else |
| 65 |
return json_decode($rsp['body'],true); |
| 66 |
} |
| 67 |
|
| 68 |
function sf_admin_menu() { |
| 69 |
add_menu_page('MembershipWorks Admin','Membership Works','edit_users','sf_admin_page','sf_admin_page','data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBzdGFuZGFsb25lPSJubyI/Pgo8IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDIwMDEwOTA0Ly9FTiIKICJodHRwOi8vd3d3LnczLm9yZy9UUi8yMDAxL1JFQy1TVkctMjAwMTA5MDQvRFREL3N2ZzEwLmR0ZCI+CjxzdmcgdmVyc2lvbj0iMS4wIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciCiB2aWV3Qm94PSIwIDAgNDY2IDQ2NiI+CjxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKDAuMDAwMDAwLDQ2Ni4wMDAwMDApIHNjYWxlKDAuMTAwMDAwLC0wLjEwMDAwMCkiCmZpbGw9IiNGRkZGRkYiIHN0cm9rZT0ibm9uZSI+CjxwYXRoIGQ9Ik0xNzU1IDQxMjQgYy0yNyAtMiAtOTAgLTkgLTE0MCAtMTUgLTU3OSAtNzEgLTEwMDggLTQ2MyAtMTEyMSAtMTAyNAotMjEgLTEwNyAtMjkgLTM1OCAtMTUgLTQ3OCBsMTEgLTk2IC0yNDYgLTUxMSBjLTEzNSAtMjgxIC0yNDQgLTUxMyAtMjQxIC01MTYKMyAtMyAyOSAyNyA1OSA2OCAzMCA0MCAzMDMgNDEzIDYwOCA4MjggMzA0IDQxNSA1NTggNzYxIDU2NSA3NjggOSAxMCAzMCAtNzcKOTUgLTQwNSA0NiAtMjMwIDg2IC00MjEgODkgLTQyNSA0IC00IDE0NSAxODEgMzE1IDQxMiAxNjkgMjMxIDMxMSA0MjAgMzE1CjQyMCA2IDAgMzMzIC0xNjMwIDMzMSAtMTY1MyAwIC00IC04NCAtNiAtMTg3IC01IGwtMTg3IDMgLTg0IDQyOCBjLTQ3IDIzNQotODcgNDI3IC05MSA0MjcgLTMgMCAtMTQ1IC0xOTEgLTMxNiAtNDI0IC0xNzAgLTIzMyAtMzEyIC00MjIgLTMxNCAtNDIwIC0yIDIKLTQxIDE5MSAtODYgNDE5IC00NSAyMjggLTg0IDQxNyAtODcgNDIxIC01IDUgLTM4OCAtMzExIC0zODggLTMyMCAwIC0xMSA2OQotMTUzIDEwMyAtMjExIDM1MCAtNjA5IDk1NSAtMTA3MCAxNjA4IC0xMjI1IDIxMSAtNTAgNTEzIC02NSA3MDQgLTM2IDYwMCA5MgoxMDEzIDQ4OSAxMTA5IDEwNjUgMTggMTA3IDIxIDM1OCA2IDQ2MyBsLTEwIDY2IDI1MCA1MTggYzEzNyAyODUgMjQ3IDUyMCAyNDUKNTIzIC02IDUgOTIgMTM4IC02MzEgLTg0OCBsLTYxOSAtODQ0IC04NSA0MjcgYy00NiAyMzQgLTg4IDQyNSAtOTIgNDI0IC0zIC0yCi0xNDYgLTE5MyAtMzE2IC00MjYgLTIyMCAtMjk4IC0zMTIgLTQxNyAtMzE2IC00MDUgLTggMjcgLTMyNiAxNjM3IC0zMjYgMTY1MQowIDkgNDUgMTIgMTg3IDEwIGwxODggLTMgODQgLTQzMiBjNDcgLTIzOCA4OCAtNDMzIDkxIC00MzMgMyAwIDE0NSAxOTEgMzE1CjQyNCAxNzEgMjMzIDMxMyA0MjEgMzE2IDQxNyA0IC0zIDQzIC0xOTIgODcgLTQyMCA0NSAtMjI3IDgzIC00MTYgODYgLTQxOCA2Ci02IDM4NiAzMTYgMzg2IDMyOCAwIDMxIC0xMzQgMjcwIC0yMjQgMzk5IC0xMzAgMTg4IC0zMzQgNDA2IC01MDYgNTQ0IC0zNDYKMjc2IC03NzAgNDY3IC0xMTU2IDUyMCAtMTE2IDE2IC0yODcgMjUgLTM2OSAyMHoiLz4KPC9nPgo8L3N2Zz4K','2.99'); |
| 70 |
add_submenu_page('sf_admin_page','Members','Members','edit_users','sf_admin_members','sf_admin_page'); |
| 71 |
add_submenu_page('sf_admin_page','Folders','Folders','edit_users','sf_admin_folders','sf_admin_page'); |
| 72 |
add_submenu_page('sf_admin_page','Labels','Labels & Membership','edit_users','sf_admin_labels','sf_admin_page'); |
| 73 |
add_submenu_page('sf_admin_page','Event List','Event List','edit_users','sf_admin_event-list','sf_admin_page'); |
| 74 |
add_submenu_page('sf_admin_page','Event Calendar','Event Calendar','edit_users','sf_admin_calendar','sf_admin_page'); |
| 75 |
add_submenu_page('sf_admin_page','Forms Carts Donations','Forms Carts Donations','edit_users','sf_admin_forms','sf_admin_page'); |
| 76 |
add_submenu_page('sf_admin_page','Jobs/Other Boards','Jobs/Other Boards','edit_users','sf_admin_boards','sf_admin_page'); |
| 77 |
add_submenu_page('sf_admin_page','Customization','Customization','edit_users','sf_admin_custom','sf_admin_page'); |
| 78 |
add_submenu_page('sf_admin_page','Help','Help','edit_users','sf_admin_help','sf_admin_page'); |
| 79 |
add_submenu_page('sf_admin_page','Organization Settings','Organization Settings','edit_users','sf_admin_account','sf_admin_page'); |
| 80 |
add_submenu_page('sf_admin_page','Plugin Settings','Plugin Settings','manage_options','sf_admin_options','sf_admin_options'); |
| 81 |
} |
| 82 |
|
| 83 |
function sf_admin_init() { |
| 84 |
register_setting('sf_admin_group','sf_set','sf_admin_validate'); |
| 85 |
} |
| 86 |
|
| 87 |
if (is_admin()) { |
| 88 |
add_action('admin_init','sf_admin_init'); |
| 89 |
add_action('admin_menu','sf_admin_menu'); |
| 90 |
} |
| 91 |
|
| 92 |
function sf_admin_options() { |
| 93 |
if (!current_user_can('manage_options')) { |
| 94 |
wp_die(__('You do not have sufficient permissions to access this page.')); |
| 95 |
} |
| 96 |
echo '<div class="wrap"><h1>MembershipWorks Plugin Settings</h1>' |
| 97 |
.'<form action="options.php" method="post">'; |
| 98 |
settings_fields("sf_admin_group"); |
| 99 |
$settings=get_option('sf_set',array()); |
| 100 |
echo '<table class="form-table">' |
| 101 |
.'<tr valign="top"><th scope="row">Organization ID</th><td><input type="text" name="sf_set[org]" value="'.esc_attr(isset($settings['org'])?$settings['org']:'').'" /></td></tr>' |
| 102 |
.'<tr valign="top"><th scope="row">Facebook App ID (optional)</th><td><input type="text" name="sf_set[fbk]" value="'.esc_attr(isset($settings['fbk'])?$settings['fbk']:'').'" /></td></tr>' |
| 103 |
.'<tr valign="top"><th scope="row">Google Maps API key (optional)</th><td><input type="text" name="sf_set[map]" value="'.esc_attr(isset($settings['map'])?$settings['map']:'').'" /></td></tr>' |
| 104 |
.'<tr valign="top"><th scope="row">Customize text for directory search button</th><td><input type="text" name="sf_set[fnd]" value="'.esc_attr(empty($settings['fnd'])?'Search':$settings['fnd']).'" /></td></tr>' |
| 105 |
.'<tr valign="top"><th scope="row">Customize text for directory group email button</th><td><input type="text" name="sf_set[rsp]" placeholder="disabled" value="'.esc_attr(isset($settings['rsp'])?$settings['rsp']:'').'" /></td></tr>' |
| 106 |
.'<tr valign="top"><th scope="row">Disable social share buttons</th><td><input type="checkbox" name="sf_set[scl]"'.(empty($settings['scl'])?'':' checked="1"').' /></td></tr>' |
| 107 |
.'<tr valign="top"><th scope="row">Open directory/listing links in new tab (referral information not passed)</th><td><input type="checkbox" name="sf_set[wgo]"'.(empty($settings['wgo'])?'':' checked="1"').' /></td></tr>' |
| 108 |
.'<tr valign="top"><th scope="row">Load js/css inline</th><td><input type="checkbox" name="sf_set[htm]"'.(empty($settings['htm'])?'':' checked="1"').' /></td></tr>' |
| 109 |
.'<tr valign="top"><th scope="row">URL redirect upon signing out</th><td><input type="text" name="sf_set[out]" value="'.esc_url(empty($settings['out'])?'':$settings['out']).'" /></td></tr>' |
| 110 |
.'<tr valign="top"><th scope="row">Page top offset (pixels)</th><td><input type="text" name="sf_set[top]" value="'.esc_attr(empty($settings['top'])?'':$settings['top']).'" /></td></tr>' |
| 111 |
.'<tr valign="top"><th scope="row">Member only content login required message</th><td><textarea name="sf_set[mol]" style="width:500px">'.esc_textarea(empty($settings['mol'])?'The following content is accessible for members only, please sign in.':$settings['mol']).'</textarea></td></tr>' |
| 112 |
.'<tr valign="top"><th scope="row">Member only content membership past due message</th><td><textarea name="sf_set[moe]" style="width:500px">'.esc_textarea(empty($settings['moe'])?'The following content is not accessible because your membership has expired.':$settings['moe']).'</textarea></td></tr>' |
| 113 |
.'<tr valign="top"><th scope="row">Member only content account no access message</th><td><textarea name="sf_set[mon]" style="width:500px">'.esc_textarea(empty($settings['mon'])?'The following content is not accessible for your account.':$settings['mon']).'</textarea></td></tr>' |
| 114 |
.'<tr valign="top"><th scope="row">Member only content session expired message</th><td><textarea name="sf_set[moi]" style="width:500px">'.esc_textarea(empty($settings['moi'])?'Your session has expired, please sign in again.':$settings['moi']).'</textarea></td></tr>' |
| 115 |
.'<tr valign="top"><th scope="row">MembershipWorks data connection</th><td><select name="sf_set[ssl]"><option value=""'.(empty($settings['ssl'])?' selected':'').'>Connect via HTTPS</option><option value="1"'.(!empty($settings['ssl'])&&$settings['ssl']!='2'?' selected':'').'>Connect via HTTP for public data</option><option value="2"'.(!empty($settings['ssl'])&&$settings['ssl']=='2'?' selected':'').'>Connect via HTTP ** INSECURE ** MAY COMPROMISE MEMBER PASSWORDS AND DATA</option></td></tr>' |
| 116 |
.'</table>' |
| 117 |
//.(empty($settings['wpl'])?'':('<input type="hidden" name="sf_set[wpl]" value="'.$settings['wpl'].'" />')) |
| 118 |
.'<p class="submit"><input type="submit" name="submit" id="submit" class="button-primary" value="Save Changes"></p>' |
| 119 |
.'</form></div>'; |
| 120 |
} |
| 121 |
|
| 122 |
function sf_admin_validate($in) { |
| 123 |
if (!current_user_can('manage_options')) { |
| 124 |
wp_die(__('You do not have sufficient permissions to access this page.')); |
| 125 |
} |
| 126 |
$raw=current_user_can('unfiltered_html'); |
| 127 |
$in['org']=intval($in['org']); |
| 128 |
$in['org']=(is_int($in['org'])?strval($in['org']):''); |
| 129 |
if (!empty($in['fbk'])) $in['fbk']=trim($in['fbk']); else unset($in['fbk']); |
| 130 |
if (!empty($in['map'])) $in['map']=trim($in['map']); else unset($in['map']); |
| 131 |
if (!empty($in['fnd'])) $in['fnd']=trim($in['fnd']); else unset($in['fnd']); |
| 132 |
if (!empty($in['rsp'])) $in['rsp']=trim($in['rsp']); else unset($in['rsp']); |
| 133 |
if (!empty($in['scl'])) $in['scl']='1'; else unset($in['scl']); |
| 134 |
if (!empty($in['wgo'])) $in['wgo']='1'; else unset($in['wgo']); |
| 135 |
if (!empty($in['htm'])) $in['htm']='1'; else unset($in['htm']); |
| 136 |
if (!empty($in['out'])) $in['out']=trim($in['out']); else unset($in['out']); |
| 137 |
if (!empty($in['top'])) $in['top']=trim($in['top']); else unset($in['top']); |
| 138 |
if (!empty($in['mol'])) $in['mol']=$raw?trim($in['mol']):wp_kses_post(trim($in['mol'])); else unset($in['mol']); |
| 139 |
if (!empty($in['moe'])) $in['moe']=$raw?trim($in['moe']):wp_kses_post(trim($in['moe'])); else unset($in['moe']); |
| 140 |
if (!empty($in['mon'])) $in['mon']=$raw?trim($in['mon']):wp_kses_post(trim($in['mon'])); else unset($in['mon']); |
| 141 |
if (!empty($in['moi'])) $in['moi']=$raw?trim($in['moi']):wp_kses_post(trim($in['moi'])); else unset($in['moi']); |
| 142 |
if (!empty($in['ssl'])) $in['ssl']=trim($in['ssl']); else unset($in['ssl']); |
| 143 |
return $in; // preserve other fields for $in including wpl |
| 144 |
} |
| 145 |
|
| 146 |
function sf_admin_page() { |
| 147 |
global $plugin_page; |
| 148 |
$settings=get_option('sf_set',array()); |
| 149 |
switch (substr($plugin_page,9)) { |
| 150 |
case 'members': $ini='folder/Members'; $hme='folder/Members'; break; |
| 151 |
case 'labels': $ini='labels'; $hme='labels'; break; |
| 152 |
case 'folders': $ini='folders'; $hme='folders'; break; |
| 153 |
case 'event-list': $ini='!event-list'; $hme='!event-list'; break; |
| 154 |
case 'calendar': $ini='!calendar'; $hme='!calendar'; break; |
| 155 |
case 'forms': $ini='forms'; $hme='forms'; break; |
| 156 |
case 'boards': $ini='boards'; $hme='boards'; break; |
| 157 |
case 'custom': $ini='custom'; $hme='custom'; break; |
| 158 |
case 'help': $ini='!help'; $hme='!help'; break; |
| 159 |
case 'account': $ini='account/manage'; $hme='account'; break; |
| 160 |
default: $ini='dashboard'; $hme='dashboard'; break; |
| 161 |
} |
| 162 |
echo '<div id="SFctr" class="SF" data-org="10000" data-hme="'.esc_attr($hme).'" data-ini="'.esc_attr($ini).'"'.(empty($settings['map'])?'':(' data-map="'.esc_attr($settings['map']).'"')).' data-typ="org" data-wpo="options.php" style="position:relative;padding:30px 20px 20px;"></div>' |
| 163 |
.'<script>function sf_admin(){' |
| 164 |
.'var t=document.getElementById("toplevel_page_sf_admin_page");' |
| 165 |
.'if (!t) return;' |
| 166 |
.'var a=t.querySelectorAll(".wp-submenu a"),i,x,n;' |
| 167 |
.'for(i=0;n=a[i];i++){' |
| 168 |
.'x=n.href.split("sf_admin_")[1];' |
| 169 |
.'n.parentNode.className="";' |
| 170 |
.'if (x=="options") continue;' |
| 171 |
.'else if (x=="page"){n.innerHTML="Dashboard";n.parentNode.id="SFhdrdbd";n.href="#dashboard";}' |
| 172 |
.'else if (x=="members"){n.parentNode.id="SFhdrdem";n.href="#folder/Members";}' |
| 173 |
.'else if (x=="labels"){n.parentNode.id="SFhdrlbl";n.href="#labels";}' |
| 174 |
.'else if (x=="folders"){n.parentNode.id="SFhdrdek";n.href="#folders";}' |
| 175 |
.'else if (x=="event-list"){n.parentNode.id="SFhdrevl";n.href="#!event-list";}' |
| 176 |
.'else if (x=="calendar"){n.parentNode.id="SFhdrevc";n.href="#!calendar";}' |
| 177 |
.'else if (x=="forms"){n.parentNode.id="SFhdrfrm";n.href="#forms";}' |
| 178 |
.'else if (x=="boards"){n.parentNode.id="SFhdrlbd";n.href="#boards";}' |
| 179 |
.'else if (x=="help"){n.parentNode.id="SFhdrhlp";n.href="#help";}' |
| 180 |
.'else if (x=="custom"){n.parentNode.id="SFhdrtpl";n.href="#custom";}' |
| 181 |
.'else if (x=="account"){n.parentNode.id="SFhdracc";n.href="#account";}' |
| 182 |
.'}' |
| 183 |
.'}sf_admin();</script>' |
| 184 |
.'<script type="text/javascript" src="https://cdn.membershipworks.com/all.js"></script>' |
| 185 |
.'<script>SF.init();</script>'; |
| 186 |
if (empty($settings['org'])) { |
| 187 |
echo '<form id="SFwpo" style="display:none" action="options.php" method="post">'; |
| 188 |
settings_fields("sf_admin_group"); |
| 189 |
echo '</form>'; |
| 190 |
} |
| 191 |
} |
| 192 |
|
| 193 |
function sf_enqueue_mfm_script() { |
| 194 |
global $SF_enqueue_css,$SF_page_data; |
| 195 |
wp_register_script('sf-mfm','https://cdn.membershipworks.com/mfm.js',array(),null,true); |
| 196 |
if (!empty($SF_enqueue_css)||!empty($SF_page_data)) { |
| 197 |
wp_register_style('sf-css','https://cdn.membershipworks.com/all.css',array(),null,'all'); |
| 198 |
wp_enqueue_style('sf-css'); |
| 199 |
} |
| 200 |
} |
| 201 |
add_action('wp_enqueue_scripts','sf_enqueue_mfm_script'); |
| 202 |
|
| 203 |
function sf_title() { |
| 204 |
global $SF_page_data; |
| 205 |
$arg=func_get_args(); |
| 206 |
if (empty($SF_page_data)||empty($SF_page_data['ttl'])) |
| 207 |
return empty($arg)?'':$arg[0]; |
| 208 |
return $SF_page_data['ttl']; |
| 209 |
} |
| 210 |
|
| 211 |
function sf_mfm_init() { |
| 212 |
global $post,$SF_page_data,$SF_enqueue_css; |
| 213 |
add_filter('the_content','sf_shortcode',class_exists('ET_Builder_Element')||function_exists('et_setup_theme')?10:9,1); |
| 214 |
add_filter('the_content','sf_shortcode',99,1); |
| 215 |
add_filter('widget_text','sf_shortcode',10,1); |
| 216 |
add_filter('document_title_parts','sf_document_title_parts',20,1); |
| 217 |
if (empty($post)||!is_object($post)) return; |
| 218 |
$arg=func_get_args(); |
| 219 |
$settings=get_option('sf_set',array()); |
| 220 |
if (empty($settings['org'])) |
| 221 |
return; |
| 222 |
for ($x=false,$i=0,$l=strlen($post->post_content),$mat=array();$i<$l&&(($x=strpos($post->post_content,'[memberfindme open=',$i))!==false||($x=strpos($post->post_content,'[mw open=',$i))!==false);$i=$x+1) { |
| 223 |
$y=strpos($post->post_content,']',$x); |
| 224 |
if ((!$x||substr($post->post_content,$x-1,1)!='[')&&$y!==false) break; // not escaped shortcode and shortcode is closed |
| 225 |
} |
| 226 |
if ($x!==false&&empty($settings['htm'])) |
| 227 |
$SF_enqueue_css=true; |
| 228 |
if ($x!==false&&(isset($_GET['_escaped_fragment_'])||preg_match("/slurp|msnbot|facebook|meta/i",$_SERVER['HTTP_USER_AGENT'])>0)) { |
| 229 |
$str=substr($post->post_content,$x+1,$y-$x-1); |
| 230 |
$mat=array(); |
| 231 |
$opt=array(); |
| 232 |
if (preg_match_all('/\s([a-z\-]*)(=("|“|”|&[^;]*;)+.*?("|“|”|&[^;]*;))?/',$str,$mat,PREG_PATTERN_ORDER)&&!empty($mat)&&!empty($mat[1])) foreach($mat[1] as $key=>$val) |
| 233 |
$opt[$val]=empty($mat[2][$key])?'':trim(preg_replace('/^=("|“|”|&[^;]*;)*|("|“|”|&[^;]*;)*$/','',$mat[2][$key])); |
| 234 |
if (isset($_GET['_escaped_fragment_'])) { |
| 235 |
$pne=$_GET['_escaped_fragment_']; |
| 236 |
remove_action('wp_head','jetpack_og_tags'); |
| 237 |
add_filter('jetpack_enable_open_graph','__return_false',99); |
| 238 |
add_filter('jetpack_disable_twitter_cards','__return_true',99); |
| 239 |
if (defined('WPSEO_VERSION')) { // Yoast SEO |
| 240 |
// add filters just in case |
| 241 |
add_filter('wpseo_canonical',function($p){global $SF_page_data;return isset($SF_page_data['rel'])?$SF_page_data['rel']:$p;}); |
| 242 |
add_filter('wpseo_title',function($p){global $SF_page_data;return isset($SF_page_data['ttl'])?$SF_page_data['ttl']:$p;}); |
| 243 |
add_filter('wpseo_metadesc',function($p){global $SF_page_data;return isset($SF_page_data['sum'])?$SF_page_data['sum']:$p;}); |
| 244 |
add_filter('wpseo_opengraph_url',function($p){global $SF_page_data;return isset($SF_page_data['rel'])?$SF_page_data['rel']:$p;}); |
| 245 |
add_filter('wpseo_opengraph_title',function($p){global $SF_page_data;return isset($SF_page_data['ttl'])?$SF_page_data['ttl']:$p;}); |
| 246 |
add_filter('wpseo_opengraph_desc',function($p){global $SF_page_data;return isset($SF_page_data['sum'])?$SF_page_data['sum']:$p;}); |
| 247 |
add_filter('wpseo_opengraph_image',function($p){global $SF_page_data;return isset($SF_page_data['img'])?$SF_page_data['img']:$p;}); |
| 248 |
// remove wpseo from wp_head and wp_title |
| 249 |
if (class_exists('Yoast\WP\SEO\Integrations\Front_End_Integration')) { |
| 250 |
global $wp_filter; |
| 251 |
if (!empty($wp_filter['wp_head'])) foreach($wp_filter['wp_head'] as $priority=>$list) foreach($list as $id=>$func) if (strpos($id,'wpseo_')!==false) |
| 252 |
remove_action('wp_head',$id,intval($priority)); |
| 253 |
if (!empty($wp_filter['wp_title'])) foreach($wp_filter['wp_title'] as $priority=>$list) foreach($list as $id=>$func) if (strpos($id,'filter_title')!==false) |
| 254 |
remove_action('wp_title',$id,intval($priority)); |
| 255 |
} else if (!empty($wpseo_front)||(class_exists('WPSEO_Frontend')&&method_exists('WPSEO_Frontend','get_instance'))) { |
| 256 |
$tmp=empty($wpseo_front)?WPSEO_Frontend::get_instance():$wpseo_front; |
| 257 |
remove_action('wp_head',array($tmp,'head'),1); |
| 258 |
add_filter('wpseo_title','__return_empty_string'); |
| 259 |
if (method_exists($tmp,'flush_cache')&&remove_action('wp_footer',array($tmp,'flush_cache'),-1)) |
| 260 |
ob_end_flush(); |
| 261 |
} |
| 262 |
} else if (defined('AIOSEOP_VERSION')) { // All in One SEO |
| 263 |
global $aiosp; |
| 264 |
if (!empty($aiosp)) |
| 265 |
remove_action('wp_head',array($aiosp,'wp_head'),apply_filters('aioseop_wp_head_priority',1)); |
| 266 |
} |
| 267 |
remove_action('wp_head','rel_canonical'); |
| 268 |
remove_action('wp_head','index_rel_link'); |
| 269 |
remove_action('wp_head','start_post_rel_link'); |
| 270 |
remove_action('wp_head','adjacent_posts_rel_link_wp_head'); |
| 271 |
add_action('wp_head','sf_head',0); |
| 272 |
add_filter('wp_title','sf_title',99,3); |
| 273 |
} else if (!empty($opt['open'])) { |
| 274 |
$pne=$opt['open']; |
| 275 |
} else { |
| 276 |
$pne=false; |
| 277 |
} |
| 278 |
if (!empty($pne)) { |
| 279 |
$qry=array('org'=>$settings['org'],'hdr'=>'','dtl'=>'','url'=>get_permalink(),'pne'=>$pne); |
| 280 |
if (!empty($opt['lbl'])) $qry['lbl']=$opt['lbl']; else if (!empty($opt['labels'])) $qry['lbl']=$opt['labels']; |
| 281 |
if (!empty($opt['folder'])) $qry['dek']=$opt['folder']; |
| 282 |
if (isset($opt['evg'])) $qry['evg']=$opt['evg']; |
| 283 |
$SF_page_data=sf_api('http','GET','api',$qry); |
| 284 |
if (empty($SF_page_data)||!empty($SF_page_data['error'])) |
| 285 |
$SF_page_data=false; |
| 286 |
else |
| 287 |
$SF_page_data['set']=$settings; |
| 288 |
} |
| 289 |
} |
| 290 |
if (!empty($SF_page_data)||strpos($post->post_content,'[memberonly')!==false) { |
| 291 |
if (!defined('DONOTCACHEPAGE')) define('DONOTCACHEPAGE',true); |
| 292 |
if (!defined('DONOTCACHEOBJECT')) define('DONOTCACHEOBJECT',true); |
| 293 |
if (!defined('DONOTCDN')) define('DONOTCDN',true); |
| 294 |
if (function_exists('wp_using_ext_object_cache')) { |
| 295 |
wp_using_ext_object_cache(false); |
| 296 |
wp_cache_flush(); |
| 297 |
wp_cache_init(); |
| 298 |
} |
| 299 |
nocache_headers(); |
| 300 |
setcookie('wordpress_donotcache',time()); |
| 301 |
} |
| 302 |
} |
| 303 |
add_action('wp','sf_mfm_init'); |
| 304 |
|
| 305 |
function sf_document_title_parts($title) { |
| 306 |
global $SF_page_data; |
| 307 |
if (!empty($SF_page_data)&&!empty($SF_page_data['ttl'])) |
| 308 |
$title['title']=$SF_page_data['ttl']; |
| 309 |
return $title; |
| 310 |
} |
| 311 |
|
| 312 |
function sf_head() { |
| 313 |
global $SF_page_data; |
| 314 |
if (!empty($SF_page_data)) { |
| 315 |
$out=array(); |
| 316 |
if (isset($SF_page_data['sum'])) |
| 317 |
$out[]='<meta name="description" content="'.str_replace('"','"',$SF_page_data['sum']).'" />'; |
| 318 |
if (isset($SF_page_data['ttl'])) { |
| 319 |
$out[]='<meta property="og:site_name" content="'.str_replace('"','"',get_bloginfo('name')).'" />'; |
| 320 |
$out[]='<meta property="og:title" content="'.str_replace('"','"',$SF_page_data['ttl']).'" />'; |
| 321 |
} |
| 322 |
if (isset($SF_page_data['img'])) { |
| 323 |
$out[]='<meta property="og:image" content="'.$SF_page_data['img'].'" />'; |
| 324 |
$out[]='<meta property="og:image:secure_url" content="'.str_replace('http://','https://',$SF_page_data['img']).'" />'; |
| 325 |
} |
| 326 |
if (isset($SF_page_data['sum'])) { |
| 327 |
$out[]='<meta property="og:description" content="'.str_replace('"','"',$SF_page_data['sum']).'" />'; |
| 328 |
} |
| 329 |
if (isset($_GET['_escaped_fragment_'])&&isset($SF_page_data['rel'])) { |
| 330 |
$out[]='<meta property="og:url" content="'.$SF_page_data['rel'].'" />'; |
| 331 |
$out[]='<link rel="canonical" href="'.$SF_page_data['rel'].'" />'; |
| 332 |
} |
| 333 |
if (isset($SF_page_data['nxt'])) |
| 334 |
$out[]='<link rel="next" href="'.$SF_page_data['nxt'].'" />'; |
| 335 |
if (isset($SF_page_data['prv'])) |
| 336 |
$out[]='<link rel="prev" href="'.$SF_page_data['prv'].'" />'; |
| 337 |
echo implode("\r\n",$out).(count($out)?"\r\n":''); |
| 338 |
} |
| 339 |
} |
| 340 |
|
| 341 |
function sf_preprocess_memberonly_shortcode($content) { |
| 342 |
global $SF_member_account,$SF_member_labels,$SF_member_folders; |
| 343 |
$settings=get_option('sf_set',array()); |
| 344 |
if (empty($settings['org'])) |
| 345 |
return $content; |
| 346 |
if (current_user_can('edit_post',get_the_ID())) |
| 347 |
return $content; |
| 348 |
$check_member_labels=[]; |
| 349 |
$check_member_folders=[]; |
| 350 |
for ($i=0;$i<strlen($content)&&($x=strpos($content,'[memberonly',$i))!==false;) { |
| 351 |
$y=strpos($content,']',$x); |
| 352 |
if (($x>0&&substr($content,$x-1,1)=='[')||$y===false) { $i=$x+1; continue; } // escaped shortcode or shortcode not closed |
| 353 |
if (!defined('DONOTCACHEPAGE')) |
| 354 |
define('DONOTCACHEPAGE',true); |
| 355 |
if (($z=strpos($content,'[/memberonly]',$y))===false) { $z=strlen($content); $l=$z-$y-1; } else { $l=$z-$y-1; $z+=13; } |
| 356 |
$str=substr($content,$x+1,$y-$x-1); |
| 357 |
$mat=array(); |
| 358 |
$opt=array(); |
| 359 |
if (preg_match_all('/\s([a-z\-]*)(=("|“|”|&[^;]*;)+.*?("|“|”|&[^;]*;))?/',$str,$mat,PREG_PATTERN_ORDER)&&!empty($mat)&&!empty($mat[1])) foreach($mat[1] as $key=>$val) |
| 360 |
$opt[$val]=empty($mat[2][$key])?'':trim(preg_replace('/^=("|“|”|&[^;]*;)*|("|“|”|&[^;]*;)*$/','',$mat[2][$key])); |
| 361 |
if (!empty($opt['label'])||!empty($opt['labels'])) { |
| 362 |
$arr=explode(',',empty($opt['label'])?$opt['labels']:$opt['label']); |
| 363 |
foreach($arr as $val) if (($val=strtolower(trim(urldecode($val))))&&!isset($SF_member_labels[$val])) { |
| 364 |
$SF_member_labels[$val]=false; |
| 365 |
$check_member_labels[]=$val; |
| 366 |
} |
| 367 |
} |
| 368 |
if (!empty($opt['level'])||!empty($opt['levels'])) { |
| 369 |
$arr=explode(',',empty($opt['level'])?$opt['levels']:$opt['level']); |
| 370 |
foreach($arr as $val) if (($val=strtolower(trim(urldecode($val))))&&!isset($SF_member_labels[$val])) { |
| 371 |
$SF_member_labels[$val]=false; |
| 372 |
$check_member_labels[]=$val; |
| 373 |
} |
| 374 |
} |
| 375 |
if (!empty($opt['folder'])||!empty($opt['folders'])) { |
| 376 |
$arr=explode(',',empty($opt['folder'])?$opt['folders']:$opt['folder']); |
| 377 |
foreach($arr as $val) if (($val=strtolower(trim(urldecode($val))))&&!isset($SF_member_folders[$val])) { |
| 378 |
$SF_member_folders[$val]=false; |
| 379 |
$check_member_folders[]=$val; |
| 380 |
} |
| 381 |
} |
| 382 |
if (empty($opt['label'])&&empty($opt['labels'])&&empty($opt['level'])&&empty($opt['levels'])&&empty($opt['folder'])&&empty($opt['folders'])&&!isset($SF_member_folders['members'])) { |
| 383 |
$SF_member_folders['members']=false; |
| 384 |
$check_member_folders[]='members'; |
| 385 |
} |
| 386 |
$i=$z+1; |
| 387 |
} |
| 388 |
if (!empty($check_member_labels)||!empty($check_member_folders)) { |
| 389 |
// check if user has required labels |
| 390 |
if (!empty($_SERVER)&&!empty($_SERVER['HTTP_COOKIE'])&&preg_match('/^SFSF=[^;]*|\\sSFSF=[^;]*/',$_SERVER['HTTP_COOKIE'],$_sf)) |
| 391 |
$_sf=preg_replace('/\\s|\\+/','',substr($_sf[0],strpos($_sf[0],'=')+1)); |
| 392 |
else if (!empty($_COOKIE['SFSF'])) |
| 393 |
$_sf=strlen($_COOKIE['SFSF'])<2?'':$_COOKIE['SFSF']; |
| 394 |
else |
| 395 |
$_sf=''; |
| 396 |
if ($_sf) { |
| 397 |
$tmp=array('org'=>$settings['org'],'sfsf'=>$_sf); |
| 398 |
if (!empty($check_member_labels)) $tmp['lbl']=$check_member_labels; |
| 399 |
if (!empty($check_member_folders)) $tmp['dek']=$check_member_folders; |
| 400 |
$usr=sf_api(empty($settings['ssl'])||$settings['ssl']!='2'?'https':'http','GET','v1/lbl',$tmp); |
| 401 |
if (empty($usr)) { |
| 402 |
$SF_member_account=array('error'=>'Invalid session'); |
| 403 |
} else { |
| 404 |
$SF_member_account=array_diff_key($usr,array('lbl'=>1)); |
| 405 |
if (!empty($usr['lbl'])) foreach($usr['lbl'] as $i=>$x) { |
| 406 |
if ($x['typ']==1) |
| 407 |
$SF_member_folders[strtolower(trim($x['lbl']))]=true; |
| 408 |
else |
| 409 |
$SF_member_labels[strtolower(trim($x['lbl']))]=true; |
| 410 |
} |
| 411 |
} |
| 412 |
} |
| 413 |
} |
| 414 |
return $content; |
| 415 |
} |
| 416 |
|
| 417 |
function sf_shortcode($content) { |
| 418 |
global $SF_member_account,$SF_member_labels,$SF_member_folders,$SF_page_data; |
| 419 |
$settings=get_option('sf_set',array()); |
| 420 |
$wpl=defined('SF_WPL')?preg_replace('/^http[s]?:\\/\\/[^\\/]*/','',SF_WPL>=3?admin_url('admin-ajax.php'):site_url('wp-login.php','login_post')):(empty($settings['wpl'])?'':$settings['wpl']); |
| 421 |
$opened=false; |
| 422 |
// fetch member labels/folders data |
| 423 |
sf_preprocess_memberonly_shortcode($content); |
| 424 |
// process memberonly shortcodes |
| 425 |
for ($i=0;$i<strlen($content)&&($x=strpos($content,'[memberonly',$i))!==false;) { |
| 426 |
$y=strpos($content,']',$x); |
| 427 |
if (($x>0&&substr($content,$x-1,1)=='[')||$y===false) { $i=$x+1; continue; } // escaped shortcode or shortcode not closed |
| 428 |
if (($z=strpos($content,'[/memberonly]',$y))===false) { $z=strlen($content); $l=$z-$y-1; } else { $l=$z-$y-1; $z+=13; } |
| 429 |
$str=substr($content,$x+1,$y-$x-1); |
| 430 |
$mat=array(); |
| 431 |
$opt=array(); |
| 432 |
if (preg_match_all('/\s([a-z\-]*)(=("|“|”|&[^;]*;)+.*?("|“|”|&[^;]*;))?/',$str,$mat,PREG_PATTERN_ORDER)&&!empty($mat)&&!empty($mat[1])) foreach($mat[1] as $key=>$val) |
| 433 |
$opt[$val]=empty($mat[2][$key])?'':trim(preg_replace('/^=("|“|”|&[^;]*;)*|("|“|”|&[^;]*;)*$/','',$mat[2][$key])); |
| 434 |
if (empty($settings['org'])) { |
| 435 |
$out='<div>Organization ID not setup. Please update settings.</div>'; |
| 436 |
} else if (current_user_can('edit_post',get_the_ID())) { |
| 437 |
$tmp=[]; |
| 438 |
foreach ($opt as $key=>$val) $tmp[]=$key.'="'.$val.'"'; |
| 439 |
$out='[administrator notice: content below memberonly '.implode(' ',$tmp).']' |
| 440 |
.substr($content,$y+1,$l); |
| 441 |
} else { |
| 442 |
if (empty($SF_member_account)) { |
| 443 |
$msg=isset($opt['message'])?$opt['message']:(empty($settings['mol'])?'The following content is accessible for members only, please sign in.':$settings['mol']); |
| 444 |
} else if (!empty($SF_member_account['error'])) { |
| 445 |
$msg=isset($opt['message'])?$opt['message']:(empty($settings['moi'])?'Your session has expired, please sign in again.':$settings['moi']); |
| 446 |
} else if (!empty($SF_member_account['end'])) { |
| 447 |
$msg=isset($opt['message'])?$opt['message']:(empty($settings['moe'])?'The following content is not accessible because your membership has expired.':$settings['moe']); |
| 448 |
} else { |
| 449 |
$msg=isset($opt['message'])?$opt['message']:(empty($settings['mon'])?'The following content is not accessible for your account.':$settings['mon']); |
| 450 |
if ($msg!==false&&(!empty($opt['label'])||!empty($opt['labels']))) { |
| 451 |
$arr=explode(',',empty($opt['label'])?$opt['labels']:$opt['label']); |
| 452 |
foreach ($arr as $key=>$val) if (!empty($SF_member_labels[strtolower(trim(urldecode($val)))])) $msg=false; |
| 453 |
} |
| 454 |
if ($msg!==false&&(!empty($opt['level'])||!empty($opt['levels']))) { |
| 455 |
$arr=explode(',',empty($opt['level'])?$opt['levels']:$opt['level']); |
| 456 |
foreach ($arr as $key=>$val) if (!empty($SF_member_labels[strtolower(trim(urldecode($val)))])) $msg=false; |
| 457 |
} |
| 458 |
if ($msg!==false&&(!empty($opt['folder'])||!empty($opt['folders']))) { |
| 459 |
$arr=explode(',',empty($opt['folder'])?$opt['folders']:$opt['folder']); |
| 460 |
foreach ($arr as $key=>$val) if (!empty($SF_member_folders[strtolower(trim(urldecode($val)))])) $msg=false; |
| 461 |
} |
| 462 |
if ($msg!==false&&empty($opt['label'])&&empty($opt['labels'])&&empty($opt['level'])&&empty($opt['levels'])&&empty($opt['folder'])&&empty($opt['folders'])&&!empty($SF_member_folders['members'])) { |
| 463 |
$msg=false; |
| 464 |
} |
| 465 |
} |
| 466 |
if ($msg===false&&isset($opt['false'])) { |
| 467 |
$out=''; |
| 468 |
} else if ($msg===false||isset($opt['false'])) { |
| 469 |
$out=trim(preg_replace('/^<br(\\s\\/)?>|<br(\\s\\/)?>$/','',substr($content,$y+1,$l))); |
| 470 |
} else if (is_singular()&&!empty($opt['nonmember-redirect'])) { |
| 471 |
$out=(isset($opt['nomessage'])?'':('<span class="memberonly">'.__($msg).'</span>')) |
| 472 |
.'<script>setTimeout(\'window.location="'.esc_url($opt['nonmember-redirect']).'"\',2000);</script>'; |
| 473 |
$opened=true; |
| 474 |
} else if (is_singular()&&!$opened&&!empty($opt['nonmember'])) { |
| 475 |
$out=(isset($opt['nomessage'])?'':('<div class="memberonly" style="margin-bottom:20px">'.__($msg).'</div>')) |
| 476 |
.'[mw open="'.$opt['nonmember'].'"]'; |
| 477 |
} else if (is_singular()&&!$opened&&(empty($SF_member_account)||!empty($SF_member_account['error']))&&!isset($opt['nologin'])) { |
| 478 |
$out='<div class="memberonlywrapper" style="padding:40px 0 0;margin:40px 0;border-top:1px solid #ddd;border-bottom:1px solid #ddd">' |
| 479 |
.(isset($opt['nomessage'])?'':('<div class="memberonly" style="margin-bottom:20px">'.__($msg).'</div>')) |
| 480 |
.'<div id="SFctr" class="SF" data-sfi="1" data-org="'.esc_attr($settings['org']).'" data-ini="myaccount" data-zzz="'.esc_url(get_permalink()).'"' |
| 481 |
.(empty($wpl)?'':' data-wpl="'.esc_url($wpl).'"') |
| 482 |
.' style="position:relative;height:auto;margin-bottom:40px">' |
| 483 |
.'<div id="SFpne" style="position:relative"><div class="SFpne">Loading...</div></div>' |
| 484 |
.'<div style="clear:both"></div>' |
| 485 |
.(empty($settings['htm'])?'':'<script type="text/javascript" src="https://cdn.membershipworks.com/mfm.js" defer="defer"></script>') |
| 486 |
.'</div></div>'; |
| 487 |
if (empty($settings['htm'])) |
| 488 |
wp_enqueue_script('sf-mfm'); |
| 489 |
if (!defined('DONOTROCKETOPTIMIZE')) |
| 490 |
define('DONOTROCKETOPTIMIZE',true); |
| 491 |
$opened=true; |
| 492 |
} else { |
| 493 |
$out=(isset($opt['nomessage'])?'':('<span class="memberonly">'.__($msg).'</span>')); |
| 494 |
} |
| 495 |
} |
| 496 |
$content=substr_replace($content,$out,$x,$z-$x); |
| 497 |
$i=$x+strlen($out); |
| 498 |
} |
| 499 |
// process mw shortcodes |
| 500 |
for ($i=0;$i<strlen($content)&&(($x=strpos($content,'[memberfindme ',$i))!==false||($x=strpos($content,'[mw ',$i))!==false);) { |
| 501 |
$y=strpos($content,']',$x); |
| 502 |
if (($x>0&&substr($content,$x-1,1)=='[')||$y===false) { $i=$x+1; continue; } // escaped shortcode or shortcode not closed |
| 503 |
$str=substr($content,$x+1,$y-$x-1); |
| 504 |
$mat=array(); |
| 505 |
$opt=array(); |
| 506 |
if (!preg_match_all('/\s([a-z\-]*)(=("|“|”|&[^;]*;)+.*?("|“|”|&[^;]*;))?/',$str,$mat,PREG_PATTERN_ORDER)||empty($mat)||empty($mat[1])) { $i=$x+1; continue; } |
| 507 |
foreach ($mat[1] as $key=>$val) $opt[$val]=empty($mat[2][$key])?'':trim(preg_replace('/^=("|“|”|&[^;]*;)*|("|“|”|&[^;]*;)*$/','',$mat[2][$key])); |
| 508 |
// create output |
| 509 |
if (empty($settings['org'])) { |
| 510 |
$out='<div>Organization ID not setup. Please update settings.</div>'; |
| 511 |
} else if (!$opened&&isset($opt['open'])) { |
| 512 |
$out=(empty($settings['htm'])?'':'<div style="display:none"><script>if(typeof(SF)=="object"&&SF.close)SF.close();</script></div>') |
| 513 |
.'<div id="SFctr" class="SF" data-org="'.esc_attr($settings['org']).'" data-ini="'.esc_attr($opt['open']).'"' |
| 514 |
.(empty($settings['map'])?'':(' data-map="'.esc_attr($settings['map']).'"')) |
| 515 |
.(empty($settings['fbk'])?'':(' data-fbk="'.esc_attr($settings['fbk']).'"')) |
| 516 |
.(empty($settings['fnd'])?'':(' data-fnd="'.esc_attr($settings['fnd']).'"')) |
| 517 |
.(empty($settings['rsp'])?'':(' data-rsp="'.esc_attr($settings['rsp']).'"')) |
| 518 |
.(empty($settings['scl'])&&empty($opt['noshare'])?'':(' data-scl="0"')) |
| 519 |
.(empty($settings['wgo'])?'':(' data-wgo="1"')) |
| 520 |
.(empty($settings['out'])?'':(' data-out="'.esc_url($settings['out']).'"')) |
| 521 |
.(empty($settings['top'])?'':(' data-top="'.esc_attr($settings['top']).'"')) |
| 522 |
.(empty($wpl)?'':' data-wpl="'.esc_url($wpl).'"') |
| 523 |
.(empty($opt['lbl'])&&empty($opt['labels'])?'':(' data-lbl="'.esc_attr(empty($opt['lbl'])?$opt['labels']:$opt['lbl']).'"')) |
| 524 |
.(empty($opt['folder'])?'':(' data-dek="'.esc_attr($opt['folder']).'"')) |
| 525 |
.(empty($opt['levels'])?'':(' data-lvl="'.esc_attr($opt['levels']).'"')) |
| 526 |
.(isset($opt['evg'])?(' data-evg="'.esc_attr($opt['evg']).'"'):'') |
| 527 |
.(isset($opt['viewport'])&&$opt['viewport']=='fixed'?(' data-ofy="1"'):'') |
| 528 |
.(isset($opt['redirect'])?(' data-zzz="'.esc_url($opt['redirect']).'"'):'') |
| 529 |
.(isset($opt['checkout'])?(' data-zgo="'.esc_url($opt['checkout']).'"'):'') |
| 530 |
.(isset($opt['ini'])&&$opt['ini']=='0'?'':' data-sfi="1"') |
| 531 |
.' style="'.(isset($opt['style'])?$opt['style']:'position:relative;height:auto').'">' |
| 532 |
.'<div id="SFpne" style="position:relative">' |
| 533 |
.(empty($SF_page_data)?(isset($opt['ini'])&&$opt['ini']=='0'?'':'<div class="SFpne">Loading...</div>'):$SF_page_data['dtl']) |
| 534 |
.'</div>' |
| 535 |
.'<div id="SFfin" style="clear:both"></div>' |
| 536 |
.(empty($settings['htm'])?'':'<script type="text/javascript" src="https://cdn.membershipworks.com/mfm.js"></script>') |
| 537 |
.'</div>'; |
| 538 |
if (empty($settings['htm'])) |
| 539 |
wp_enqueue_script('sf-mfm'); |
| 540 |
if (!defined('DONOTROCKETOPTIMIZE')) |
| 541 |
define('DONOTROCKETOPTIMIZE',true); |
| 542 |
$opened=true; |
| 543 |
} else if (isset($opt['button'])) { |
| 544 |
$out=(isset($opt['type'])?('<'.$opt['type']):'<button') |
| 545 |
.(isset($opt['type'])&&$opt['type']=='img'&&isset($opt['src'])?(' src="'.esc_url($opt['src']).'"'):'') |
| 546 |
.(isset($opt['class'])?(' class="'.esc_attr($opt['class']).'"'):'') |
| 547 |
.(isset($opt['style'])?(' style="'.esc_attr($opt['style']).'"'):' style="cursor:pointer;"') |
| 548 |
.($opt['button']=='join'?(' onclick="if(typeof(SF)!=\'undefined\')SF.open(\'account/join\');">'.(isset($opt['text'])?$opt['text']:'Join')):'') |
| 549 |
.(isset($opt['type'])?($opt['type']=='img'?'':('</'.$opt['type'].'>')):'</button>'); |
| 550 |
} else if (isset($opt['join'])) { |
| 551 |
$out=(isset($opt['type'])?('<'.$opt['type']):'<a') |
| 552 |
.(isset($opt['type'])&&$opt['type']=='img'&&isset($opt['src'])?(' src="'.esc_url($opt['src']).'"'):'') |
| 553 |
.(isset($opt['class'])?(' class="'.esc_attr($opt['class']).'"'):'') |
| 554 |
.(isset($opt['style'])?(' style="'.esc_attr($opt['style']).'"'):' style="cursor:pointer;"') |
| 555 |
.(isset($opt['type'])&&$opt['type']!='a'?(' onclick="window.location.hash=\'account/join/'.$opt['join'].'\';if(typeof(SF)!=\'undefined\')setTimeout(\'SF.init()\',50);">'):(' onclick="if(typeof(SF)!=\'undefined\')setTimeout(\'SF.init()\',50)" href="#account/join/'.$opt['join'].'">')) |
| 556 |
.(isset($opt['text'])?$opt['text']:'Join') |
| 557 |
.(isset($opt['type'])?($opt['type']=='img'?'':('</'.$opt['type'].'>')):'</a>'); |
| 558 |
} else if (isset($opt['name'])||isset($opt['check'])) { |
| 559 |
if (!isset($usl)) |
| 560 |
$usl=!empty($wpl)&&is_user_logged_in()&&get_user_meta(get_current_user_id(),'SF_ID',true)?wp_get_current_user():false; |
| 561 |
$out=(isset($opt['name'])?'<span class="SFnam">'.(empty($usl)?'':$usl->display_name).'</span>':'') |
| 562 |
.($opened||(isset($opt['name'])&&!empty($usl))?'':'<script>(function(){var i,j,a,x;try{x=localStorage.getItem("SF_nam");}catch(e){x="";}try{for(a=document.querySelectorAll(".SFnam"),i=a.length-1;i>=0;i--)a[i].innerHTML=x?x:"";}catch(e){}try{for(a=document.querySelectorAll(".SF_li"),i=a.length-1;i>=0;i--)a[i].style.display=x?"":"none";}catch(e){}try{for(a=document.querySelectorAll(".SF_lo"),i=a.length-1;i>=0;i--)a[i].style.display=x?"none":"";}catch(e){}})();</script>'); |
| 563 |
if (!defined('DONOTCACHEPAGE')) |
| 564 |
define('DONOTCACHEPAGE',true); |
| 565 |
} else if (isset($opt['listlabel'])||isset($opt['listfolder'])) { |
| 566 |
$dat=sf_api(empty($settings['ssl'])?'https':'http','GET','v1/dek',array('org'=>$settings['org'],'wem'=>1,'typ'=>isset($opt['listlabel'])?3:1,'lbl'=>isset($opt['listlabel'])?$opt['listlabel']:$opt['listfolder'])); |
| 567 |
if (!empty($dat)&&!empty($dat['error'])) |
| 568 |
$out=$dat['error']; |
| 569 |
else { |
| 570 |
$out=array(); |
| 571 |
if (!empty($dat)) foreach($dat as $usr) |
| 572 |
$out[]='<li><a href="'.$usr['url'].'">'.$usr['nam'].'</a></li>'; |
| 573 |
$out='<ul class="sf_list">'.implode('',$out).'</ul>'; |
| 574 |
} |
| 575 |
} else if (isset($opt['listevents'])) { |
| 576 |
$dat=sf_api(empty($settings['ssl'])?'https':'http','GET','v1/evt',array('org'=>$settings['org'],'wee'=>1,'grp'=>$opt['listevents'],'cnt'=>isset($opt['count'])?$opt['count']:'5','sdp'=>time())); |
| 577 |
if (!empty($dat)&&!empty($dat['error'])) |
| 578 |
$out=$dat['error']; |
| 579 |
else { |
| 580 |
$out=array(); |
| 581 |
if (!empty($dat)) foreach ($dat as $evt) { |
| 582 |
$ts=explode(',',$evt['szp']); |
| 583 |
if (!empty($evt['ezp'])&&($te=explode(',',$evt['ezp']))&&$te[0]==$ts[0]) |
| 584 |
$evt['ezp']=trim(implode(',',array_slice($te,1))); |
| 585 |
$out[]='<li><a href="'.$evt['url'].'">'.$evt['ttl'].'</a><div class="event-when"><span class="event-start">'.$evt['szp'].'</span>'.(isset($evt['ezp'])&&$evt['ezp']?('<span class="event-sep"> - </span><span class="event-end">'.$evt['ezp'].'</span>'):'').'</div></li>'; |
| 586 |
} |
| 587 |
$out='<ul class="sf_list">'.implode('',$out).'</ul>'; |
| 588 |
} |
| 589 |
} else if (isset($opt['eventwidget'])) { |
| 590 |
$out=sf_widget_event_do(array_merge($opt,array('org'=>$settings['org'])),$settings); |
| 591 |
} else if (isset($opt['folderwidget'])) { |
| 592 |
$out=sf_widget_folder_do(array_merge($opt,array('org'=>$settings['org'])),$settings); |
| 593 |
} else { |
| 594 |
$out=''; |
| 595 |
} |
| 596 |
$content=substr_replace($content,$out,$x,$y-$x+1); |
| 597 |
$i=$x+strlen($out); |
| 598 |
} |
| 599 |
if (!$opened&&!empty($SF_page_data)&&($x=strpos($content,'<div id="SFpne" style="position:relative">'))!==false&&($y=strpos($content,'<div id="SFfin" style="clear:both">'))!==false) { |
| 600 |
// replace again in case wp_autop mucks things up |
| 601 |
$content=substr_replace($content,'<div id="SFpne" style="position:relative">'.$SF_page_data['dtl'].'</div>',$x,$y-$x); |
| 602 |
} |
| 603 |
return $content; |
| 604 |
} |
| 605 |
|
| 606 |
function sf_widget_event_do($instance,$settings) { |
| 607 |
if (empty($instance['org'])) |
| 608 |
return '<div>Organization ID not setup. Please update settings.</div>'; |
| 609 |
$instance=wp_parse_args($instance,array('grp'=>'','cnt'=>'3','lgo'=>'','adn'=>'','szp'=>'','ezp'=>'')); |
| 610 |
$dat=sf_api(empty($settings)||empty($settings['ssl'])?'https':'http','GET','v1/evt',array('org'=>$instance['org'],'wee'=>1,'grp'=>$instance['grp'],'cnt'=>$instance['cnt'],'sdp'=>time())); |
| 611 |
if (empty($dat)) |
| 612 |
return '<div>No current events</div>'; |
| 613 |
if (!empty($dat)&&!empty($dat['error'])) |
| 614 |
return '<div>'.$dat['error'].'</div>'; |
| 615 |
$out=array(); |
| 616 |
foreach ($dat as $x) { |
| 617 |
$ts=explode(',',$x['szp']); |
| 618 |
if (empty($instance['szp'])&&!empty($x['ezp'])) { |
| 619 |
$te=explode(',',$x['ezp']); |
| 620 |
if ($te[0]==$ts[0]) $x['ezp']=trim(implode(',',array_slice($te,1))); |
| 621 |
} |
| 622 |
$out[]='<li class="event-item">' |
| 623 |
.'<a class="event-link" href="'.esc_url($x['url']).'">' |
| 624 |
.(empty($x['lgo'])||empty($instance['lgo'])?'':('<img class="event-thumb" src="//d1tif55lvfk8gc.cloudfront.net/'.$x['_id'].'s.jpg?'.$x['lgo'].'" alt="" style="max-width:100%"/>')) |
| 625 |
.$x['ttl'] |
| 626 |
.'</a>' |
| 627 |
.(empty($instance['szp'])||(empty($instance['exp'])&&!empty($x['ezp']))?('<div class="event-when">' |
| 628 |
.(empty($instance['szp'])?('<span class="event-start">'.$x['szp'].'</span>'):'') |
| 629 |
.(empty($instance['szp'])&&empty($instance['ezp'])&&!empty($x['ezp'])?'<span class="event-sep"> - </span>':'') |
| 630 |
.(empty($instance['ezp'])&&!empty($x['ezp'])?('<span class="event-end">'.$x['ezp'].'</span>'):'') |
| 631 |
.'</div>'):'') |
| 632 |
.(empty($instance['adn'])||empty($x['adn'])?'':('<div class="event-where">'.$x['adn'].'</div>')) |
| 633 |
.'</li>'; |
| 634 |
} |
| 635 |
return '<ul class="sf_widget_event_list" style="display:block;position:relative">'.implode($out).'</ul>'; |
| 636 |
} |
| 637 |
|
| 638 |
class sf_widget_event extends WP_Widget { |
| 639 |
public function __construct() { |
| 640 |
parent::__construct('sf_widget_event','Upcoming Events',array('description'=>'Upcoming events from your MembershipWorks calendar')); |
| 641 |
} |
| 642 |
public function widget($args,$instance ) { |
| 643 |
extract($args); |
| 644 |
$settings=get_option('sf_set',array()); |
| 645 |
if (empty($settings['org'])) { |
| 646 |
echo '<div>Organization ID not setup. Please update settings.</div>'; |
| 647 |
return; |
| 648 |
} |
| 649 |
$title=apply_filters('widget_title',$instance['title']); |
| 650 |
if (empty($title)) |
| 651 |
echo str_replace('widget_sf_widget_event','widget_sf_widget_event widget_no_title',$before_widget); |
| 652 |
else |
| 653 |
echo $before_widget.$before_title.$title.$after_title; |
| 654 |
echo sf_widget_event_do(array_merge($instance,array('org'=>$settings['org'])),$settings); |
| 655 |
echo $after_widget; |
| 656 |
} |
| 657 |
public function update($new_instance,$old_instance ) { |
| 658 |
$instance=$old_instance; |
| 659 |
$instance['title']=strip_tags($new_instance['title']); |
| 660 |
$instance['grp']=isset($new_instance['grp'])?$new_instance['grp']:''; |
| 661 |
$instance['cnt']=$new_instance['cnt']?strval(intval($new_instance['cnt'])):'0'; |
| 662 |
$instance['lgo']=empty($new_instance['lgo'])?'':'1'; |
| 663 |
$instance['adn']=empty($new_instance['adn'])?'':'1'; |
| 664 |
$instance['szp']=empty($new_instance['szp'])?'':'1'; |
| 665 |
$instance['ezp']=empty($new_instance['ezp'])?'':'1'; |
| 666 |
return $instance; |
| 667 |
} |
| 668 |
public function form($instance) { |
| 669 |
$instance=wp_parse_args($instance,array('title'=>'','grp'=>'','cnt'=>'3','lgo'=>'','adn'=>'','szp'=>'','ezp'=>'')); |
| 670 |
$title=strip_tags($instance['title']); |
| 671 |
$grp=$instance['grp']; |
| 672 |
$cnt=intval($instance['cnt']); |
| 673 |
echo '<p><label for="'.esc_attr($this->get_field_id('title')).'">Title:</label> <input class="widefat" id="'.esc_attr($this->get_field_id('title')).'" name="'.esc_attr($this->get_field_name('title')).'" type="text" value="'.esc_attr($title).'" /></p>' |
| 674 |
.'<p><label for="'.esc_attr($this->get_field_id('grp')).'">Category number (blank=all):</label> <input id="'.esc_attr($this->get_field_id('grp')).'" name="'.esc_attr($this->get_field_name('grp')).'" type="text" value="'.esc_attr($grp).'" size="3"/></p>' |
| 675 |
.'<p><label for="'.esc_attr($this->get_field_id('cnt')).'">Number of events to show:</label> <input id="'.esc_attr($this->get_field_id('cnt')).'" name="'.esc_attr($this->get_field_name('cnt')).'" type="text" value="'.esc_attr($cnt).'" size="3"/></p>' |
| 676 |
.'<p><label for="'.esc_attr($this->get_field_id('lgo')).'">Display images:</label> <input id="'.esc_attr($this->get_field_id('lgo')).'" name="'.esc_attr($this->get_field_name('lgo')).'" type="checkbox" value="1"'.(empty($instance['lgo'])?'':' checked').'/></p>' |
| 677 |
.'<p><label for="'.esc_attr($this->get_field_id('adn')).'">Display location:</label> <input id="'.esc_attr($this->get_field_id('adn')).'" name="'.esc_attr($this->get_field_name('adn')).'" type="checkbox" value="1"'.(empty($instance['adn'])?'':' checked').'/></p>' |
| 678 |
.'<p><label for="'.esc_attr($this->get_field_id('szp')).'">Hide start date/time:</label> <input id="'.esc_attr($this->get_field_id('szp')).'" name="'.esc_attr($this->get_field_name('szp')).'" type="checkbox" value="1"'.(empty($instance['szp'])?'':' checked').'/></p>' |
| 679 |
.'<p><label for="'.esc_attr($this->get_field_id('ezp')).'">Hide end date time:</label> <input id="'.esc_attr($this->get_field_id('ezp')).'" name="'.esc_attr($this->get_field_name('ezp')).'" type="checkbox" value="1"'.(empty($instance['ezp'])?'':' checked').'/></p>'; |
| 680 |
} |
| 681 |
} |
| 682 |
|
| 683 |
function sf_widget_folder_do($instance,$settings) { |
| 684 |
global $SF_widgetid; |
| 685 |
if (empty($instance['org'])) |
| 686 |
return '<div>Organization ID not setup. Please update settings.</div>'; |
| 687 |
$instance=wp_parse_args($instance,array('typ'=>'1','lbl'=>'Members','act'=>'0','delay'=>'10','nam'=>'')); |
| 688 |
$dat=sf_api(empty($settings)||empty($settings['ssl'])?'https':'http','GET','v1/dek',array('org'=>$instance['org'],'wem'=>1,'typ'=>empty($instance['typ'])?'1':$instance['typ'],'lbl'=>$instance['lbl'])); |
| 689 |
if (!empty($dat)&&!empty($dat['error'])) |
| 690 |
return '<div>'.$dat['error'].'</div>'; |
| 691 |
$out=array(); |
| 692 |
if (!empty($dat)) foreach($dat as $x) { |
| 693 |
if ($instance['act']=='1') |
| 694 |
$out[]='<li style="display:none;background-color:white;text-align:center;height:148px;padding:0;margin:0;table-layout:fixed;width:100%;"><a href="'.esc_url($x['url']).'" style="display:table-cell;vertical-align:middle;padding:10px;text-decoration:none;">' |
| 695 |
.(empty($x['lgo'])?'':('<div class="member-image"><img src="https://cdn.membershipworks.com/u/'.$x['_id'].'_lgl.jpg?'.$x['lgo'].'" alt="'.(!empty($instance['nam'])?'':esc_attr($x['nam'])).'" onerror="this.parentNode.innerHTML=this.alt;" style="display:block;margin:0 auto;max-width:100%;max-height:75px;"></div>')) |
| 696 |
.(empty($x['lgo'])||!empty($instance['nam'])?('<div class="member-name" style="display:block;width:100%;font-size:'.($x['lgo']?'1.1em':'1.5em').'">'.esc_html(html_entity_decode($x['nam'],ENT_HTML5|ENT_QUOTES)).'</div>'):'') |
| 697 |
.(empty($x['cnm'])?'':('<small class="member-tagline" style="display:block;padding:10px;">'.esc_html(html_entity_decode($x['cnm'],ENT_HTML5|ENT_QUOTES)).'</small>')) |
| 698 |
.'</a></li>'; |
| 699 |
else |
| 700 |
$out[]='<li><a href="'.esc_url($x['url']).'">' |
| 701 |
.(empty($x['lgo'])||empty($instance['lgo'])?'':('<div class="member-image"><img src="https://cdn.membershipworks.com/u/'.$x['_id'].'_lgl.jpg?'.$x['lgo'].'" alt="" onerror="this.parentNode.innerHTML=this.alt;" style="display:block;margin:0 auto;max-width:100%;max-height:75px;"></div>')) |
| 702 |
.'<span class="member-name">'.esc_html(html_entity_decode($x['nam'],ENT_HTML5|ENT_QUOTES)).'</span>' |
| 703 |
.(empty($x['cnm'])?'':('<small class="member-tagline" style="display:block;">'.esc_html(html_entity_decode($x['cnm'],ENT_HTML5|ENT_QUOTES)).'</small>')) |
| 704 |
.'</a></li>'; |
| 705 |
} |
| 706 |
$id=empty($instance['wid'])?('sf-widget-'.($SF_widgetid++)):$instance['wid']; |
| 707 |
if ($instance['act']=='1') { |
| 708 |
$delay=intval($instance['delay'])*1000; |
| 709 |
$fn=str_replace('-','_',$id); |
| 710 |
return '<ul id="'.$id.'" class="sf_widget_folder_logos" style="list-style:none;margin:0;padding:5px">'.implode($out).'</ul>' |
| 711 |
.(empty($out)?'':('<script>'.$fn.'_animate=function(){var r=document.getElementById("'.$id.'"),x=r.querySelector(\'li[style*="table;"]\');if(x){x.style.display="none";x=(x.nextSibling?x.nextSibling:r.firstChild);}else x=r.childNodes[Math.round(Math.random()*(r.childNodes.length-1))];if(x)x.style.display="table";setTimeout('.$fn.'_animate,'.($delay?$delay:10000).');};'.$fn.'_animate();</script>')); |
| 712 |
} else { |
| 713 |
return '<ul id="'.$id.'" class="sf_widget_folder_list">'.implode($out).'</ul>'; |
| 714 |
} |
| 715 |
} |
| 716 |
|
| 717 |
class sf_widget_folder extends WP_Widget { |
| 718 |
public function __construct() { |
| 719 |
parent::__construct('sf_widget_folder','Members/Folder Widget',array('description'=>'Display contacts from your MembershipWorks folder or label')); |
| 720 |
} |
| 721 |
public function widget($args,$instance ) { |
| 722 |
extract($args); |
| 723 |
$settings=get_option('sf_set',array()); |
| 724 |
if (empty($settings['org'])) { |
| 725 |
echo '<div>Organization ID not setup. Please update settings.</div>'; |
| 726 |
return; |
| 727 |
} |
| 728 |
$title=apply_filters('widget_title',$instance['title']); |
| 729 |
if (empty($title)) |
| 730 |
echo str_replace('widget_sf_widget_folder','widget_sf_widget_folder widget_no_title',$before_widget); |
| 731 |
else |
| 732 |
echo $before_widget.$before_title.$title.$after_title; |
| 733 |
echo sf_widget_folder_do(array_merge($instance,array('org'=>$settings['org'],'wid'=>($this->id).'-list')),$settings); |
| 734 |
echo $after_widget; |
| 735 |
} |
| 736 |
public function update($new_instance,$old_instance ) { |
| 737 |
$instance=$old_instance; |
| 738 |
$instance['title']=strip_tags($new_instance['title']); |
| 739 |
$instance['lbl']=trim($new_instance['lbl']); |
| 740 |
$instance['typ']=strval(intval($new_instance['typ'])); |
| 741 |
$instance['act']=strval(intval($new_instance['act'])); |
| 742 |
$instance['delay']=strval(intval($new_instance['delay'])); |
| 743 |
$instance['nam']=empty($new_instance['nam'])?'':'1'; |
| 744 |
return $instance; |
| 745 |
} |
| 746 |
public function form($instance) { |
| 747 |
$instance=wp_parse_args($instance,array('title'=>'','typ'=>'1','lbl'=>'Members','act'=>'0','delay'=>'10','nam'=>'')); |
| 748 |
$title=strip_tags($instance['title']); |
| 749 |
echo '<p><label for="'.esc_attr($this->get_field_id('title')).'">Title:</label> <input class="widefat" id="'.esc_attr($this->get_field_id('title')).'" name="'.esc_attr($this->get_field_name('title')).'" type="text" value="'.esc_attr($title).'" /></p>' |
| 750 |
.'<p><label for="'.esc_attr($this->get_field_id('lbl')).'">Folder/label name:</label> <input class="widefat" id="'.esc_attr($this->get_field_id('lbl')).'" name="'.esc_attr($this->get_field_name('lbl')).'" type="text" value="'.esc_attr($instance['lbl']).'" /></p>' |
| 751 |
.'<p><label for="'.esc_attr($this->get_field_id('typ')).'">Type:</label> <select id="'.esc_attr($this->get_field_id('typ')).'" name="'.esc_attr($this->get_field_name('typ')).'">' |
| 752 |
.'<option value="1"'.($instance['typ']=='1'?' selected="selected"':'').'>Public folder</option>' |
| 753 |
.'<option value="3"'.($instance['typ']=='3'?' selected="selected"':'').'>Publicly searchable label</option>' |
| 754 |
.'</select></p>' |
| 755 |
.'<p><label for="'.esc_attr($this->get_field_id('act')).'">Display:</label> <select id="'.esc_attr($this->get_field_id('act')).'" name="'.esc_attr($this->get_field_name('act')).'" onchange="this.parentNode.nextSibling.style.display=(this.value==\'1\'?\'\':\'none\');">' |
| 756 |
.'<option value="0"'.($instance['act']=='0'?' selected="selected"':'').'>List</option>' |
| 757 |
.'<option value="1"'.($instance['act']=='1'?' selected="selected"':'').'>Slideshow</option>' |
| 758 |
.'</select></p>' |
| 759 |
.'<div'.($instance['act']=='1'?'>':' style="display:none;">') |
| 760 |
.'<p><label for="'.esc_attr($this->get_field_id('delay')).'">Seconds between slides:</label> <input id="'.esc_attr($this->get_field_id('delay')).'" name="'.esc_attr($this->get_field_name('delay')).'" type="text" value="'.esc_attr($instance['delay']).'" size="3"/></p>' |
| 761 |
.'<p><label for="'.esc_attr($this->get_field_id('nam')).'">Always display name:</label> <input id="'.esc_attr($this->get_field_id('nam')).'" name="'.esc_attr($this->get_field_name('nam')).'" type="checkbox" value="1"'.(empty($instance['nam'])?'':' checked').'/></p>' |
| 762 |
.'</div>'; |
| 763 |
} |
| 764 |
} |
| 765 |
|
| 766 |
function sf_widgets_init() { |
| 767 |
register_widget('sf_widget_event'); |
| 768 |
register_widget('sf_widget_folder'); |
| 769 |
} |
| 770 |
add_action('widgets_init','sf_widgets_init'); |
| 771 |
|
| 772 |
?> |