AspexiFBlikebox

The Aspexi Facebook Like Box AspexiFBlikebox class.

Defined (1)

The class is defined in the following location(s).

/aspexi-facebook-like-box.php  
  1. class AspexiFBlikebox { 
  2.  
  3. public $cf = array(); // config array 
  4. private $messages = array(); // admin messages 
  5. private $errors = array(); // admin errors 
  6.  
  7. public function __construct() { 
  8.  
  9. /** Configuration */ 
  10. $this->settings(); 
  11.  
  12. add_action( 'admin_menu', array( &$this, 'admin_menu')); 
  13. add_action( 'init', array( &$this, 'init' ), 10 ); 
  14. add_action( 'wp_footer', array( &$this, 'get_html' ), 21 ); 
  15. add_action( 'admin_enqueue_scripts', array( &$this, 'admin_scripts') ); 
  16. add_action( 'wp_enqueue_scripts', array( &$this, 'init_scripts') ); 
  17. add_filter( 'plugin_action_links', array( &$this, 'settings_link' ), 10, 2); 
  18.  
  19. register_uninstall_hook( __FILE__, array( 'AspexiFBlikebox', 'uninstall' ) ); 
  20.  
  21. /** WP init action */ 
  22. public function init() { 
  23.  
  24. /** Internationalization */ 
  25. load_plugin_textdomain( 'aspexifblikebox', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); 
  26.  
  27. /** Exras */ 
  28. $this->extras_init(); 
  29.  
  30. public function settings() { 
  31.  
  32. /** Defaults */ 
  33. $cf_default = array( 
  34. 'aspexifblikebox_version' => ASPEXIFBLIKEBOX_VERSION,  
  35. 'url' => '',  
  36. 'locale' => 'en_GB',  
  37. 'status' => 'enabled',  
  38. 'page_plugin' => 'enabled',  
  39. ); 
  40.  
  41. if ( !get_option( 'aspexifblikebox_options' ) ) 
  42. add_option( 'aspexifblikebox_options', $cf_default, '', 'yes' ); 
  43.  
  44. $this->cf = get_option( 'aspexifblikebox_options' ); 
  45.  
  46. /** Upgrade */ 
  47. if( $this->cf['aspexifblikebox_version'] != ASPEXIFBLIKEBOX_VERSION ) { 
  48. switch( $this->cf['aspexifblikebox_version'] ) { 
  49. case '1.0.0': 
  50. $this->cf['status'] = 'enabled'; 
  51. $this->cf['aspexifblikebox_version'] = ASPEXIFBLIKEBOX_VERSION; 
  52. update_option( 'aspexifblikebox_options', $this->cf, '', 'yes' ); 
  53. break; 
  54. default: 
  55. $this->cf = array_merge( $cf_default, (array)$this->cf ); 
  56. $this->cf['aspexifblikebox_version'] = ASPEXIFBLIKEBOX_VERSION; 
  57. update_option( 'aspexifblikebox_options', $this->cf, '', 'yes' ); 
  58.  
  59. public function settings_link( $action_links, $plugin_file ) { 
  60. if( $plugin_file == plugin_basename(__FILE__) ) { 
  61.  
  62. $pro_link = $this->get_pro_link(); 
  63. array_unshift( $action_links, $pro_link ); 
  64.  
  65. $settings_link = '<a href="themes.php?page=' . basename( __FILE__ ) . '">' . __("Settings") . '</a>'; 
  66. array_unshift( $action_links, $settings_link ); 
  67.  
  68. return $action_links; 
  69.  
  70. private function add_message( $message ) { 
  71. $message = trim( $message ); 
  72.  
  73. if( strlen( $message ) ) 
  74. $this->messages[] = $message; 
  75.  
  76. private function add_error( $error ) { 
  77. $error = trim( $error ); 
  78.  
  79. if( strlen( $error ) ) 
  80. $this->errors[] = $error; 
  81.  
  82. public function has_errors() { 
  83. return count( $this->errors ); 
  84.  
  85. public function display_admin_notices( $echo = false ) { 
  86. $ret = ''; 
  87.  
  88. foreach( (array)$this->errors as $error ) { 
  89. $ret .= '<div class="error fade"><p><strong>'.$error.'</strong></p></div>'; 
  90.  
  91. foreach( (array)$this->messages as $message ) { 
  92. $ret .= '<div class="updated fade"><p><strong>'.$message.'</strong></p></div>'; 
  93.  
  94. if( $echo ) 
  95. echo $ret; 
  96. else 
  97. return $ret; 
  98.  
  99. public function admin_menu() { 
  100. add_submenu_page( 'themes.php', __( 'Aspexi Facebook Like Box', 'aspexifblikebox' ), __( 'Facebook Like Box', 'aspexifblikebox' ), 'manage_options', basename(__FILE__), array( &$this, 'admin_page') ); 
  101.  
  102. public function admin_page() { 
  103.  
  104. if (!current_user_can('manage_options')) { 
  105. wp_die(__('You do not have sufficient permissions to access this page.')); 
  106.  
  107. $preview = false; 
  108.  
  109. if( isset( $_REQUEST['pp'] ) && check_admin_referer( 'page_plugin_toggle' ) ) { 
  110.  
  111. if( 'enabled' == $this->is_pp() && 'disable' == $_REQUEST['pp']) { 
  112. $this->cf['page_plugin'] = 'disabled'; 
  113. update_option( 'aspexifblikebox_options', $this->cf, '', 'yes' ); 
  114.  
  115. // request action 
  116. if ( isset( $_REQUEST['afblb_form_submit'] ) && check_admin_referer( plugin_basename(__FILE__), 'afblb_nonce_name' ) ) { 
  117.  
  118. if( !in_array( $_REQUEST['afblb_status'], array('enabled', 'disabled') ) ) 
  119. $this->add_error( __( 'Wrong or missing status. Available statuses: enabled and disabled. Settings not saved.', 'aspexifblikebox' ) ); 
  120.  
  121. if( !$this->has_errors() ) { 
  122. $aspexifblikebox_request_options = array(); 
  123.  
  124. $aspexifblikebox_request_options['url'] = isset( $_REQUEST['afblb_url'] ) ? trim( $_REQUEST['afblb_url'] ) : ''; 
  125. $aspexifblikebox_request_options['locale'] = isset( $_REQUEST['afblb_locale'] ) ? $_REQUEST['afblb_locale'] : ''; 
  126. $aspexifblikebox_request_options['status'] = isset( $_REQUEST['afblb_status'] ) ? $_REQUEST['afblb_status'] : ''; 
  127. $this->cf = array_merge( (array)$this->cf, $aspexifblikebox_request_options ); 
  128.  
  129. update_option( 'aspexifblikebox_options', $this->cf, '', 'yes' ); 
  130. $this->add_message( __( 'Settings saved.', 'aspexifblikebox' ) );  
  131. }  
  132.  
  133. // Preview maybe 
  134. if( @$_REQUEST['preview'] ) 
  135. $preview = true; 
  136. else 
  137. $preview = false; 
  138.  
  139. // Locale 
  140. $locales = array( 
  141. 'Afrikaans' => 'af_ZA',  
  142. 'Akan' => 'ak_GH',  
  143. 'Albanian' => 'sq_AL',  
  144. 'Amharic' => 'am_ET',  
  145. 'Arabic' => 'ar_AR',  
  146. 'Armenian' => 'hy_AM',  
  147. 'Assamese' => 'as_IN',  
  148. 'Aymara' => 'ay_BO',  
  149. 'Azerbaijani' => 'az_AZ',  
  150. 'Basque' => 'eu_ES',  
  151. 'Belarusian' => 'be_BY',  
  152. 'Bengali' => 'bn_IN',  
  153. 'Bosnian' => 'bs_BA',  
  154. 'Breton' => 'br_FR',  
  155. 'Bulgarian' => 'bg_BG',  
  156. 'Burmese' => 'my_MM',  
  157. 'Catalan' => 'ca_ES',  
  158. 'Cebuano' => 'cx_PH',  
  159. 'Cherokee' => 'ck_US',  
  160. 'Chewa' => 'ny_MW',  
  161. 'Classical Greek' => 'gx_GR',  
  162. 'Corsican' => 'co_FR',  
  163. 'Croatian' => 'hr_HR',  
  164. 'Czech' => 'cs_CZ',  
  165. 'Danish' => 'da_DK',  
  166. 'Dutch (Belgi)' => 'nl_BE',  
  167. 'Dutch' => 'nl_NL',  
  168. 'English (India)' => 'en_IN',  
  169. 'English (Pirate)' => 'en_PI',  
  170. 'English (UK)' => 'en_GB',  
  171. 'English (Upside Down)' => 'en_UD',  
  172. 'English (US)' => 'en_US',  
  173. 'Esperanto' => 'eo_EO',  
  174. 'Estonian' => 'et_EE',  
  175. 'Faroese' => 'fo_FO',  
  176. 'Filipino' => 'tl_PH',  
  177. 'Finnish' => 'fi_FI',  
  178. 'French (Canada)' => 'fr_CA',  
  179. 'French (France)' => 'fr_FR',  
  180. 'Frisian' => 'fy_NL',  
  181. 'Fulah' => 'ff_NG',  
  182. 'Galician' => 'gl_ES',  
  183. 'Ganda' => 'lg_UG',  
  184. 'Georgian' => 'ka_GE',  
  185. 'German' => 'de_DE',  
  186. 'Greek' => 'el_GR',  
  187. 'Guarani' => 'gn_PY',  
  188. 'Gujarati' => 'gu_IN',  
  189. 'Hausa' => 'ha_NG',  
  190. 'Hebrew' => 'he_IL',  
  191. 'Hindi' => 'hi_IN',  
  192. 'Hungarian' => 'hu_HU',  
  193. 'Icelandic' => 'is_IS',  
  194. 'Igbo' => 'ig_NG',  
  195. 'Indonesian' => 'id_ID',  
  196. 'Irish' => 'ga_IE',  
  197. 'Italian' => 'it_IT',  
  198. 'Japanese (Kansai)' => 'ja_KS',  
  199. 'Japanese' => 'ja_JP',  
  200. 'Javanese' => 'jv_ID',  
  201. 'Kannada' => 'kn_IN',  
  202. 'Kazakh' => 'kk_KZ',  
  203. 'Khmer' => 'km_KH',  
  204. 'Kinyarwanda' => 'rw_RW',  
  205. 'Klingon' => 'tl_ST',  
  206. 'Korean' => 'ko_KR',  
  207. 'Kurdish (Kurmanji)' => 'ku_TR',  
  208. 'Lao' => 'lo_LA',  
  209. 'Latin' => 'la_VA',  
  210. 'Latvian' => 'lv_LV',  
  211. 'Leet Speak' => 'fb_LT',  
  212. 'Limburgish' => 'li_NL',  
  213. 'Lingala' => 'ln_CD',  
  214. 'Lithuanian' => 'lt_LT',  
  215. 'Macedonian' => 'mk_MK',  
  216. 'Malagasy' => 'mg_MG',  
  217. 'Malay' => 'ms_MY',  
  218. 'Malayalam' => 'ml_IN',  
  219. 'Maltese' => 'mt_MT',  
  220. 'Marathi' => 'mr_IN',  
  221. 'Mongolian' => 'mn_MN',  
  222. 'Ndebele' => 'nd_ZW',  
  223. 'Nepali' => 'ne_NP',  
  224. 'Northern Smi' => 'se_NO',  
  225. 'Norwegian (bokmal)' => 'nb_NO',  
  226. 'Norwegian (nynorsk)' => 'nn_NO',  
  227. 'Oriya' => 'or_IN',  
  228. 'Pashto' => 'ps_AF',  
  229. 'Persian' => 'fa_IR',  
  230. 'Polish' => 'pl_PL',  
  231. 'Portuguese (Brazil)' => 'pt_BR',  
  232. 'Portuguese (Portugal)' => 'pt_PT',  
  233. 'Punjabi' => 'pa_IN',  
  234. 'Quechua' => 'qu_PE',  
  235. 'Romanian' => 'ro_RO',  
  236. 'Romansh' => 'rm_CH',  
  237. 'Russian' => 'ru_RU',  
  238. 'Sanskrit' => 'sa_IN',  
  239. 'Sardinian' => 'sc_IT',  
  240. 'Serbian' => 'sr_RS',  
  241. 'Shona' => 'sn_ZW',  
  242. 'Silesian' => 'sz_PL',  
  243. 'Simplified Chinese (China)' => 'zh_CN',  
  244. 'Sinhala' => 'si_LK',  
  245. 'Slovak' => 'sk_SK',  
  246. 'Slovenian' => 'sl_SI',  
  247. 'Somali' => 'so_SO',  
  248. 'Sorani Kurdish' => 'cb_IQ',  
  249. 'Spanish (Colombia)' => 'es_CO',  
  250. 'Spanish (Spain)' => 'es_ES',  
  251. 'Spanish' => 'es_LA',  
  252. 'Swahili' => 'sw_KE',  
  253. 'Swedish' => 'sv_SE',  
  254. 'Syriac' => 'sy_SY',  
  255. 'Tajik' => 'tg_TJ',  
  256. 'Tamazight' => 'tz_MA',  
  257. 'Tamil' => 'ta_IN',  
  258. 'Tatar' => 'tt_RU',  
  259. 'Telugu' => 'te_IN',  
  260. 'Thai' => 'th_TH',  
  261. 'Traditional Chinese (Hong Kong)' => 'zh_HK',  
  262. 'Traditional Chinese (Taiwan)' => 'zh_TW',  
  263. 'Turkish' => 'tr_TR',  
  264. 'Turkmen' => 'tk_TM',  
  265. 'Ukrainian' => 'uk_UA',  
  266. 'Urdu' => 'ur_PK',  
  267. 'Uzbek' => 'uz_UZ',  
  268. 'Vietnamese' => 'vi_VN',  
  269. 'Welsh' => 'cy_GB',  
  270. 'Wolof' => 'wo_SN',  
  271. 'Xhosa' => 'xh_ZA',  
  272. 'Yiddish' => 'yi_DE',  
  273. 'Yoruba' => 'yo_NG',  
  274. 'Zazaki' => 'zz_TR',  
  275. 'Zulu' => 'zu_ZA' 
  276. ); 
  277.  
  278. $locales_input = '<select name="afblb_locale">'; 
  279.  
  280. foreach( $locales as $k => $v ) { 
  281. $locales_input .= '<option value="'.$v.'"'.( ( $this->cf['locale'] == $v ) ? ' selected="selected"' : '' ).'>'.$k.'</option>'; 
  282.  
  283. $locales_input .= '</select>'; 
  284.  
  285. ?> 
  286. <div class="wrap"> 
  287. <div id="icon-link" class="icon32"></div><h2><?php _e( 'Aspexi Facebook Page Plugin (formerly Like Box) Settings', 'aspexifblikebox' ); ?></h2> 
  288. <?php $this->display_admin_notices( true ); ?> 
  289. <div id="poststuff" class="metabox-holder"> 
  290. <div id="post-body"> 
  291. <div id="post-body-content"> 
  292. <form method="post" action="<?php echo ASPEXIFBLIKEBOX_ADMIN_URL; ?>"> 
  293.  
  294. <input type="hidden" name="afblb_form_submit" value="submit" /> 
  295.  
  296. <div class="postbox"> 
  297. <h3><span><?php _e('Settings', 'aspexifblikebox'); ?></span></h3> 
  298. <div class="inside"> 
  299. <table class="form-table"> 
  300. <tbody> 
  301. <tr valign="top"> 
  302. <th scope="row"><?php _e('Page Plugin', 'aspexifblikebox'); ?></th> 
  303. <td><select name="afblb_status"> 
  304. <option value="enabled"<?php if( 'enabled' == $this->cf['status'] ) echo ' selected="selected"'; ?>><?php _e('enabled', 'aspexifblikebox'); ?></option> 
  305. <option value="disabled"<?php if( 'disabled' == $this->cf['status'] ) echo ' selected="selected"'; ?>><?php _e('disabled', 'aspexifblikebox'); ?></option> 
  306. </select></td> 
  307. </tr>  
  308. <tr valign="top"> 
  309. <th scope="row"><?php _e('Facebook Page URL', 'aspexifblikebox'); ?></strong></th> 
  310. <td>http://www.facebook.com/ <input type="text" name="afblb_url" value="<?php echo $this->cf['url']; ?>" /> 
  311. </td> 
  312. </tr> 
  313. <tr valign="top"> 
  314. <th scope="row"><?php _e('Page Plugin Height', 'aspexifblikebox'); ?></th> 
  315. <td><input type="text" name="afblb_height" value="285" size="3" disabled readonly /> px<?php echo $this->get_pro_link(); ?></td> 
  316. </tr> 
  317. <tr valign="top"> 
  318. <th scope="row"><?php _e('Page Plugin Width', 'aspexifblikebox'); ?></th> 
  319. <td><input type="text" name="afblb_width" value="245" size="3" disabled readonly /> px<?php echo $this->get_pro_link(); ?></td> 
  320. </tr> 
  321. <tr valign="top"> 
  322. <th scope="row"><?php _e('Show Friends\' Faces', 'aspexifblikebox'); ?></th> 
  323. <td><input type="checkbox" value="on" name="afblb_faces" checked disabled readonly /><?php echo $this->get_pro_link(); ?></td> 
  324. </tr> 
  325. <tr valign="top"> 
  326. <th scope="row"><?php _e('Show Posts (Stream)', 'aspexifblikebox'); ?></th> 
  327. <td><input type="checkbox" value="on" name="afblb_stream" disabled readonly /><?php echo $this->get_pro_link(); ?></td> 
  328. </tr> 
  329. <tr valign="top"> 
  330. <th scope="row"> 
  331. <?php _e( 'Hide CTA', 'aspexifblikebox'); ?><br> 
  332. <span style="font-size: 10px;"><?php _e( 'Hide the custom call to action button (if available)', 'aspexifblikebox' ); ?></span> 
  333. </th> 
  334. <td><input type="checkbox" value="on" name="afbsb_cta" disabled readonly><?php echo $this->get_pro_link(); ?></td> 
  335. </tr> 
  336. <tr valign="top"> 
  337. <th scope="row"><?php _e('Hide Cover', 'aspexifblikebox'); ?><br /><span style="font-size: 10px"><?php _e('Hide cover photo in the header.', 'aspexifblikebox'); ?></span></th> 
  338. <td><input type="checkbox" value="on" name="afblb_header" disabled readonly /><?php echo $this->get_pro_link(); ?></td> 
  339. </tr> 
  340. <tr valign="top"> 
  341. <th scope="row"><?php _e('Small Header', 'aspexifblikebox'); ?><br /><span style="font-size: 10px"><?php _e('Use the small header instead.', 'aspexifblikebox'); ?></span></th> 
  342. <td><input type="checkbox" value="on" name="afblb_small_header" disabled readonly /><?php echo $this->get_pro_link(); ?></td> 
  343. </tr> 
  344. <tr valign="top"> 
  345. <th scope="row"><?php _e('Localization', 'aspexifblikebox'); ?><br /><span style="font-size: 10px"><?php _e('Change might not be visible immediately due to Facebook / browser cache.', 'aspexifblikebox'); ?></span></th> 
  346. <td><?php echo $locales_input; ?></td> 
  347. </tr> 
  348. <?php 
  349. echo apply_filters('aspexifblikebox_admin_settings', ''); 
  350. ?>  
  351. </tbody> 
  352. </table> 
  353.  
  354. </div> 
  355. </div> 
  356.  
  357. <p><input class="button-primary" type="submit" name="send" value="<?php _e('Save all settings', 'aspexifblikebox'); ?>" id="submitbutton" /> 
  358. <input class="button-secondary" type="submit" name="preview" value="<?php _e('Save and preview', 'aspexifblikebox'); ?>" id="previewbutton" /></p> 
  359. <?php wp_nonce_field( plugin_basename( __FILE__ ), 'afblb_nonce_name' ); ?> 
  360.  
  361. <div class="postbox"> 
  362. <h3><span><?php _e('Button Settings', 'aspexifblikebox'); ?></span></h3> 
  363. <div class="inside"> 
  364. <table class="form-table"> 
  365. <tbody> 
  366. <tr valign="top"> 
  367. <th scope="row"><?php _e('Button Space', 'aspexifblikebox'); ?><br /><span style="font-size: 10px"><?php _e('Space between button and page edge', 'aspexifblikebox'); ?></span></th> 
  368. <td><input type="text" name="afblb_btspace" value="0" size="3" disabled readonly /> px<?php echo $this->get_pro_link(); ?></td> 
  369. </tr> 
  370. <tr valign="top"> 
  371. <th scope="row"><?php _e('Button Placement', 'aspexifblikebox'); ?></th> 
  372. <td><input type="radio" name="afblb_btvertical" value="top" disabled readonly /> <?php _e('top of like box', 'aspexifblikebox'); ?><br /> 
  373. <input type="radio" name="afblb_btvertical" value="middle" checked disabled readonly /> <?php _e('middle of like box', 'aspexifblikebox'); ?><br /> 
  374. <input type="radio" name="afblb_btvertical" value="bottom" disabled readonly /> <?php _e('bottom of like box', 'aspexifblikebox'); ?><br /> 
  375. <input type="radio" name="afblb_btvertical" value="fixed" disabled readonly /> <?php _e('fixed', 'aspexifblikebox'); ?> 
  376. <input type="text" name="afblb_btvertical_val" value="" size="3" disabled readonly /> px <?php _e('from slider top', 'aspexifblikebox'); ?><?php echo $this->get_pro_link(); ?> 
  377. </td> 
  378. </tr> 
  379. <tr valign="top"> 
  380. <th scope="row"><?php _e('Button Image', 'aspexifblikebox'); ?></th> 
  381. <td><span><input type="radio" name="afblb_btimage" value="fb1-right" checked disabled readonly /> <img src="<?php echo ASPEXIFBLIKEBOX_URL.'images/fb1-right.png'; ?>" alt="" style="cursor:pointer;" /></span> 
  382. <span><input type="radio" name="afblb_btimage" value="" disabled readonly /> <img src="<?php echo ASPEXIFBLIKEBOX_URL.'images/preview-buttons.jpg'; ?>" alt="" style="cursor:pointer;" /></span><?php echo $this->get_pro_link(); ?> 
  383. </td> 
  384. </tr>  
  385. <tr valign="top"> 
  386. <th scope="row"><?php _e('High Resolution', 'aspexifblikebox'); ?><br /><span style="font-size: 10px"><?php _e('Use SVG high quality images instead of PNG if possible. Recommended for Retina displays (iPhone, iPad, MacBook Pro).', 'aspexifblikebox'); ?></span></th> 
  387. <td><input type="checkbox" value="on" name="afblb_bthq" disabled readonly /> <img src="<?php echo ASPEXIFBLIKEBOX_URL.'images/svgonoff.png'; ?>" alt="" style="cursor:pointer;" /><?php echo $this->get_pro_link(); ?></td> 
  388. </tr>  
  389. </tbody> 
  390. </table> 
  391. </div> 
  392. </div> 
  393.  
  394. <p><input class="button-primary" type="submit" name="send" value="<?php _e('Save all settings', 'aspexifblikebox'); ?>" id="submitbutton" /> 
  395. <input class="button-secondary" type="submit" name="preview" value="<?php _e('Save and preview', 'aspexifblikebox'); ?>" id="previewbutton" /></p> 
  396.  
  397. <div class="postbox"> 
  398. <h3><span><?php _e('Advanced Look and Feel', 'aspexifblikebox'); ?></span></h3> 
  399. <div class="inside"> 
  400. <table class="form-table"> 
  401. <tbody> 
  402. <tr valign="top"> 
  403. <th scope="row"><?php _e('Placement', 'aspexifblikebox'); ?></th> 
  404. <td><select name="afblb_placement" disabled readonly> 
  405. <option value="left"><?php _e('left', 'aspexifblikebox'); ?></option> 
  406. <option value="right" selected="selected"><?php _e('right', 'aspexifblikebox'); ?></option> 
  407. </select><?php echo $this->get_pro_link(); ?></td> 
  408. </tr> 
  409. <tr valign="top"> 
  410. <th scope="row"><?php _e('Vertical placement', 'aspexifblikebox'); ?></th> 
  411. <td><input type="radio" name="afblb_vertical" value="middle" checked disabled readonly /> <?php _e('middle', 'aspexifblikebox'); ?><br /> 
  412. <input type="radio" name="afblb_vertical" value="fixed" disabled readonly /> <?php _e('fixed', 'aspexifblikebox'); ?> 
  413. <input type="text" name="afblb_vertical_val" value="" size="3" disabled readonly /> px <?php _e('from page top', 'aspexifblikebox'); ?><?php echo $this->get_pro_link(); ?> 
  414. </td> 
  415. </tr> 
  416. <tr valign="top"> 
  417. <th scope="row"><?php _e('Border Color', 'aspexifblikebox'); ?></th> 
  418. <td><input type="text" name="afblb_bordercolor" class="bordercolor-field" value="#3B5998" size="6" disabled readonly /><?php echo $this->get_pro_link(); ?></td> 
  419. </tr>  
  420. <tr valign="top"> 
  421. <th scope="row"><?php _e('Border Width', 'aspexifblikebox'); ?></th> 
  422. <td><input type="text" name="afblb_borderwidth" value="2" size="3" disabled readonly /> px<?php echo $this->get_pro_link(); ?></td> 
  423. </tr> 
  424. <tr valign="top"> 
  425. <th scope="row"><?php _e('Slide on Mouse', 'aspexifblikebox'); ?></th> 
  426. <td><select name="afblb_slideon" disabled readonly> 
  427. <option value="hover" selected="selected"><?php _e('hover', 'aspexifblikebox'); ?></option> 
  428. <option value="click"><?php _e('click', 'aspexifblikebox'); ?></option> 
  429. </select><?php echo $this->get_pro_link(); ?></td> 
  430. </tr>  
  431. <tr valign="top"> 
  432. <th scope="row"><?php _e('Slide Time', 'aspexifblikebox'); ?></th> 
  433. <td><input type="text" name="afblb_slidetime" value="400" size="3" disabled readonly /> <?php _e('milliseconds', 'aspexifblikebox'); ?><?php echo $this->get_pro_link(); ?></td> 
  434. </tr> 
  435. <tr valign="top"> 
  436. <th scope="row"><?php _e('Auto open', 'aspexifblikebox'); ?></th> 
  437. <td> 
  438. <input type="checkbox" value="on" name="afblb_autoopen" disabled readonly /><?php echo $this->get_pro_link(); ?><br> 
  439. <?php _e('Auto open after', 'aspexifblikebox'); ?> <input type="text" name="afblb_autoopentime" value="400" size="3" disabled readonly /> <?php _e('milliseconds', 'aspexifblikebox'); ?> (1000 milliseconds = 1 second) 
  440. </td> 
  441. </tr> 
  442. <tr valign="top"> 
  443. <th scope="row"><?php _e('Auto close', 'aspexifblikebox'); ?></th> 
  444. <td> 
  445. <input type="checkbox" value="on" name="afblb_autoopen" disabled readonly /><?php echo $this->get_pro_link(); ?><br> 
  446. <?php _e('Auto close after', 'aspexifblikebox'); ?> <input type="text" name="afblb_autoopentime" value="400" size="3" disabled readonly /> <?php _e('milliseconds', 'aspexifblikebox'); ?> (1000 milliseconds = 1 second) 
  447. </td> 
  448. </tr> 
  449. <tr valign="top"> 
  450. <th scope="row"><?php _e('Auto open when user reaches bottom of the page', 'aspexifblikebox'); ?></th> 
  451. <td><input type="checkbox" value="on" name="afblb_autoopenonbottom" disabled readonly /><?php echo $this->get_pro_link(); ?></td> 
  452. </tr> 
  453. <tr valign="top"> 
  454. <th scope="row"><?php _e('Auto open when user reaches position', 'aspexifblikebox'); ?></th> 
  455. <td> 
  456. <input type="checkbox" value="on" name="afblb_autoopenonposition" disabled readonly /><br> 
  457. <?php echo __( 'Auto open when user is', 'aspexifblikebox' ); ?>: <input type="text" disabled readonly name="afblb_autoopenonposition_px" size="5">px from: 
  458. <select name="afblb_autoopenonposition_name" disabled readonly> 
  459. <option value="top"><?php echo __( 'Top', 'aspexifblikebox' ); ?></option> 
  460. <option value="bottom"><?php echo __( 'Bottom', 'aspexifblikebox' ); ?></option> 
  461. </select><br> 
  462. <?php echo $this->get_pro_link(); ?> 
  463. </td> 
  464. </tr> 
  465. <tr valign="top"> 
  466. <th scope="row"><?php _e('Auto open when user reaches element', 'aspexifblikebox'); ?></th> 
  467. <td> 
  468. <input type="checkbox" value="on" name="afblb_autoopenonelement" disabled readonly /><br> 
  469. <?php echo __( 'Auto open when user reaches', 'aspexifblikebox' ); ?>: <input type="text" disabled readonly name="afblb_autoopenonelement_name" size="10" value="<?php echo $this->cf['autoopenonelement_name']; ?>"><small><?php echo __( '(jQuery selector for example #element_id, .some_class)', 'aspexifblikebox' ); ?></small><br> 
  470. <?php echo $this->get_pro_link(); ?> 
  471. </td> 
  472. </tr> 
  473. <tr valign="top"> 
  474. <th scope="row"><?php _e('Delay FB content load', 'aspexifblikebox'); ?><br /><span style="font-size: 10px"><?php _e('Checking this box will prevent from loading the facebook content while loading the whole page. With this box checked the page will load faster, but facebook content may appear a bit later while opening the box for the first time.', 'aspexifbsidebox'); ?></span></th> 
  475. <td><input type="checkbox" value="on" name="afbsb_async" disabled readonly /><?php echo $this->get_pro_link(); ?></td> 
  476. </tr> 
  477. <tr valign="top"> 
  478. <th scope="row"><?php _e('Disable on GET', 'aspexifblikebox'); ?><br /><span style="font-size: 10px"><?php _e('Example: set Parameter=iframe and Value=true. Like Box will be disabled on all URLs like yourwebsite.com/?iframe=true.', 'aspexifblikebox'); ?></span></th> 
  479. <td><?php _e('Parameter', 'aspexifblikebox'); ?>: <input type="text" name="afblb_disableparam" value="" size="6" disabled readonly /><br /> 
  480. <?php _e('Value', 'aspexifblikebox'); ?>: <input type="text" name="afblb_disableval" value="" size="6" disabled readonly /><?php echo $this->get_pro_link(); ?> 
  481. </td> 
  482. </tr>  
  483. <tr valign="top"> 
  484. <th scope="row"><?php _e('Disable on Small Screens', 'aspexifblikebox'); ?><br /><span style="font-size: 10px"><?php _e('Dynamically hide the plugin if screen size is smaller than like box size (CSS media query)', 'aspexifblikebox'); ?></span></th> 
  485. <td><input type="checkbox" value="on" name="afblb_smallscreens" checked disabled readonly /><?php echo $this->get_pro_link(); ?></td> 
  486. </tr>  
  487. </tbody> 
  488. </table> 
  489. </div> 
  490. </div> 
  491.  
  492. <p><input class="button-primary" type="submit" name="send" value="<?php _e('Save all settings', 'aspexifblikebox'); ?>" id="submitbutton" /> 
  493. <input class="button-secondary" type="submit" name="preview" value="<?php _e('Save and preview', 'aspexifblikebox'); ?>" id="previewbutton" /></p> 
  494.  
  495. <div class="postbox"> 
  496. <h3><span><?php _e('Enable on Mobile', 'aspexifblikebox'); ?></span></h3> 
  497. <div class="inside"> 
  498. <table class="form-table"> 
  499. <tbody> 
  500. <tr valign="top"> 
  501. <th scope="row"><?php _e('iPad & iPod', 'aspexifblikebox'); ?></th> 
  502. <td><input type="checkbox" value="on" name="afblb_edipad" checked disabled readonly /><?php echo $this->get_pro_link(); ?></td> 
  503. </tr> 
  504. <tr valign="top"> 
  505. <th scope="row"><?php _e('iPhone', 'aspexifblikebox'); ?></th> 
  506. <td><input type="checkbox" value="on" name="afblb_ediphone" checked disabled readonly /><?php echo $this->get_pro_link(); ?></td> 
  507. </tr> 
  508. <tr valign="top"> 
  509. <th scope="row"><?php _e('Android', 'aspexifblikebox'); ?></th> 
  510. <td><input type="checkbox" value="on" name="afblb_edandroid" checked disabled readonly /><?php echo $this->get_pro_link(); ?></td> 
  511. </tr> 
  512. <tr valign="top"> 
  513. <th scope="row"><?php _e('Other Mobile Devices', 'aspexifblikebox'); ?></th> 
  514. <td><input type="checkbox" value="on" name="afblb_edothers" checked disabled readonly /><?php echo $this->get_pro_link(); ?></td> 
  515. </tr>  
  516. </tbody> 
  517. </table> 
  518. </div> 
  519. </div> 
  520.  
  521. <p><input class="button-primary" type="submit" name="send" value="<?php _e('Save all settings', 'aspexifblikebox'); ?>" id="submitbutton" /> 
  522. <input class="button-secondary" type="submit" name="preview" value="<?php _e('Save and preview', 'aspexifblikebox'); ?>" id="previewbutton" /></p> 
  523. </form> 
  524. <div class="postbox"> 
  525. <h3><span>Made by</span></h3>  
  526. <div class="inside"> 
  527. <div style="width: 170px; margin: 0 auto;"> 
  528. <a href="<?php echo $this->get_pro_url(); ?>" target="_blank"><img src="<?php echo ASPEXIFBLIKEBOX_URL.'images/aspexi300.png'; ?>" alt="" border="0" width="150" /></a> 
  529. </div> 
  530. </div> 
  531. </div>  
  532. </div>  
  533. </div> 
  534. </div> 
  535. </div> 
  536. <?php 
  537.  
  538. // Preview 
  539. if( $preview ) { 
  540. $this->init_scripts(); 
  541. $this->get_html($preview); 
  542.  
  543. public function get_pro_url() { 
  544. return 'http://aspexi.com/downloads/aspexi-facebook-like-box-slider-hd/?src=free_plugin'; 
  545.  
  546. public function get_pro_link() { 
  547. $ret = ''; 
  548.  
  549. $ret .= '   <a href="'.$this->get_pro_url().'" target="_blank">'.__( 'Get PRO version', 'aspexifblikebox' ).'</a>'; 
  550.  
  551. return $ret; 
  552.  
  553. public function get_html( $preview = false ) { 
  554.  
  555. $url = apply_filters( 'aspexifblikebox_url', $this->cf['url'] ); 
  556. $status = apply_filters( 'aspexifblikebox_status', $this->cf['status'] ); 
  557.  
  558. // Disable maybe 
  559. if( ( !strlen( $url ) || 'enabled' != $status ) && !$preview ) 
  560. return; 
  561.  
  562. // Options 
  563. $locale = apply_filters( 'aspexifblikebox_locale', $this->cf['locale'] ); 
  564. $height = 234; 
  565. $width = 245; 
  566. $placement = 'right'; 
  567. $btspace = 0; 
  568. $btimage = 'fb1-right.png'; 
  569. $bordercolor = '#3B5998'; 
  570. $borderwidth = 2; 
  571. $bgcolor = '#ffffff'; 
  572.  
  573. $css_placement = array(); 
  574. if( 'left' == $placement ) { 
  575. $css_placement[0] = 'right'; 
  576. $css_placement[1] = '0 '.(48+$btspace).'px 0 5px'; 
  577. } else { 
  578. $css_placement[0] = 'left'; 
  579. $css_placement[1] = '0 5px 0 '.(48+$btspace).'px'; 
  580.  
  581. $css_placement[2] = '50%;margin-top:-'.floor($height/2).'px'; 
  582.  
  583. $smallscreenscss = ''; 
  584. if( $width > 0 ) { 
  585. $widthmax = (int)($width + 48 + $borderwidth + 10); 
  586. $smallscreenscss = '@media (max-width: '.$widthmax.'px) { .aspexifblikebox { display: none; } }'; 
  587.  
  588. $stream = 'false'; 
  589. $header = 'false'; 
  590.  
  591. // Facebook button image (check in THEME CHILD -> THEME PARENT -> PLUGIN DIR) 
  592. // TODO: move this to admin page 
  593. $users_button_custom = '/plugins/'.basename( dirname( __FiLE__ ) ).'/images/aspexi-fb-custom.png'; 
  594. $users_button_template = get_template_directory() . $users_button_custom; 
  595. $users_button_child = get_stylesheet_directory() . $users_button_custom; 
  596. $button_uri = ''; 
  597.  
  598. if( file_exists( $users_button_child ) ) 
  599. $button_uri = get_stylesheet_directory_uri() . $users_button_custom; 
  600. elseif( file_exists( $users_button_template ) ) 
  601. $button_uri = get_template_directory_uri() . $users_button_custom; 
  602. elseif( file_exists( plugin_dir_path( __FILE__ ).'images/'.$btimage ) ) 
  603. $button_uri = ASPEXIFBLIKEBOX_URL.'images/'.$btimage; 
  604.  
  605. if( '' == $button_uri ) { 
  606. $button_uri = ASPEXIFBLIKEBOX_URL.'images/fb1-right.png'; 
  607.  
  608. $button_uri = apply_filters( 'aspexifblikebox_button_uri', $button_uri ); 
  609.  
  610. $output = ''; 
  611.  
  612. $page_url = 'https://www.facebook.com/'.$url; 
  613.  
  614. $output .= '<div id="fb-root"></div> 
  615. <script>(function(d, s, id) { 
  616. var js, fjs = d.getElementsByTagName(s)[0]; 
  617. if (d.getElementById(id)) return; 
  618. js = d.createElement(s); js.id = id; 
  619. js.src = "//connect.facebook.net/'.$locale.'/sdk.js#xfbml=1&version=v2.5&appId=584845024998075"; 
  620. fjs.parentNode.insertBefore(js, fjs); 
  621. }(document, \'script\', \'facebook-jssdk\'));</script> 
  622. <style type="text/css">'.$smallscreenscss.' .fb-xfbml-parse-ignore {display: none;} .aspexifblikebox{box-sizing: content-box;-webkit-box-sizing: content-box;-moz-box-sizing: content-box;background: url("'.$button_uri.'") no-repeat scroll '.$css_placement[0].' transparent; float: '.$placement.';height: '.($height + ($borderwidth*2)).'px;padding: '.$css_placement[1].';width: '.$width.'px;z-index: 99999;position:fixed;'.$placement.':-'.($width+5).'px;top:'.$css_placement[2].';cursor:pointer;} .aspexifblikebox div{ padding: 0; margin-'.$placement.':-8px; border:'.$borderwidth.'px solid '.$bordercolor.'; background:'.$bgcolor.';} .aspexifblikebox span a{color: gray;text-decoration:none;} .aspexifblikebox span a:hover{text-decoration:underline;} } </style> 
  623. <div class="aspexifblikebox"><div class="fb-page" data-href="'.$page_url.'" data-width="'.$width.'" data-height="'.$height.'" data-hide-cover="false" data-show-facepile="true" data-show-posts="false" style="margin: 0;"><div class="fb-xfbml-parse-ignore"><blockquote cite="'.$page_url.'"><a href="'.$page_url.'">Facebook</a></blockquote></div></div></div>'; 
  624.  
  625. $output = apply_filters( 'aspexifblikebox_output', $output ); 
  626.  
  627. echo $output; 
  628.  
  629. public function init_scripts() { 
  630. $width = 245; 
  631. $placement = 'right'; 
  632. $slideon = 'hover'; 
  633.  
  634. wp_enqueue_script( 'aspexi-facebook-like-box', ASPEXIFBLIKEBOX_URL . 'js/aflb.js', array( 'jquery' ), false, true ); 
  635. wp_localize_script( 'aspexi-facebook-like-box', 'aflb', array( 
  636. 'slideon' => $slideon,  
  637. 'placement' => $placement,  
  638. 'width' => (int)$width 
  639. ) ); 
  640.  
  641. public static function uninstall() { 
  642.  
  643. delete_option( 'aspexifblikebox_options' ); 
  644.  
  645. public function admin_scripts() { 
  646. // premium only 
  647. return; 
  648.  
  649. public function extras_init() { 
  650. /** qTranslate */ 
  651. add_filter( 'aspexifblikebox_admin_settings', array( &$this, 'extras_qtranslate_admin' ) ); 
  652. add_filter( 'aspexifblikebox_admin_settings', array( &$this, 'extras_polylang_admin' ) ); 
  653.  
  654. public function extras_qtranslate_detect() { 
  655. global $q_config; 
  656. return (isset($q_config) && !empty($q_config)); 
  657.  
  658. public function extras_qtranslate_admin( $extra_admin_content ) { 
  659. $qtranslate_locale = $this->extras_qtranslate_detect(); 
  660.  
  661. if( $qtranslate_locale ) { 
  662. $extra_admin_content .= '<tr valign="top"> 
  663. <th scope="row">'.__('qTranslate/mqTranslate', 'aspexifblikebox').'<br /><span style="font-size: 10px">'.__('Try to detect qTranslate/mqTranslate language and force it instead of language set in Localization.', 'aspexifblikebox').'</span></th> 
  664. <td><input type="checkbox" value="on" name="afblb_qtranslate" disabled readonly />'.$this->get_pro_link().'</td> 
  665. </tr>'; 
  666.  
  667. return $extra_admin_content; 
  668.  
  669. public function extras_polylang_admin( $extra_admin_content ) { 
  670.  
  671. if(function_exists('pll_current_language')) { 
  672. $extra_admin_content .= '<tr valign="top"> 
  673. <th scope="row">'.__('Polylang', 'aspexifblikebox').'<br /><span style="font-size: 10px">'.__('Try to detect Polylang language and force it instead of language set in Localization.', 'aspexifblikebox').'</span></th> 
  674. <td><input type="checkbox" value="on" name="afblb_polylang" disabled readonly />'.$this->get_pro_link().'</td> 
  675. </tr>'; 
  676.  
  677. return $extra_admin_content; 
  678.  
  679. // Check if Page Plugin is enabled 
  680. public function is_pp() { 
  681.  
  682. return $this->cf['page_plugin'];