Advertisement
Guest User

Untitled

a guest
Oct 5th, 2018
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 30.51 KB | None | 0 0
  1. <?php
  2. /**
  3. *
  4. * @ IonCube v8.3 Loader By DoraemonPT
  5. * @ PHP 5.3
  6. * @ Decoder version : 1.0.0.7
  7. * @ Author : DoraemonPT
  8. * @ Release on : 09.05.2014
  9. * @ Website : http://EasyToYou.eu
  10. *
  11. **/
  12.  
  13. function mon_is_weblic($url) {
  14. $url = str_replace( array( 'http://', 'https://', 'www.' ), '', $url );
  15. $url = trim( esc_html( strip_tags( stripslashes( $url ) ) ) );
  16. return $url;
  17. }
  18.  
  19. function monbo_favicon_template() {
  20. if ($favicon = monchange( 'favicon' )) {
  21. $wp_filetype = wp_check_filetype( null );
  22. $favicon = basename( $favicon );
  23. $favicon = '/wp-content/plugins/monbo/images/'.$favicon.'"';
  24. }
  25.  
  26. echo '<link rel="shortcut icon" href="';
  27. echo $favicon;
  28. echo '" type="';
  29. echo $wp_filetype['type'];
  30. echo '" />
  31. <link rel="icon" href="';
  32. echo $favicon;
  33. echo '" type="';
  34. echo $wp_filetype['type'];
  35. echo '" />
  36. ';
  37. }
  38.  
  39. function monbo_logotype($logo = '') {
  40. global $site_url;
  41.  
  42. $is_front_page = is_front_page( );
  43. $newlogo = monchange( 'logotype' );
  44.  
  45. if (!$newlogo) {
  46. $newlogo = $is_front_page;
  47. $img = '';
  48.  
  49. if ($newlogo) {
  50. $img .= '<div class="hlogotext"><a href="' . $site_url . '" title="'.get_bloginfo( 'name' ) . '">';
  51. if ((bool)$logo) {
  52. $img .= '<img src="' . $newlogo . '" alt="' . get_bloginfo( 'name' ) . '" />';
  53. }
  54.  
  55. if(!$is_front_page|| monchange( 'clicklogo' ) == 'true' ){
  56. }
  57. $site_url = mon_is_weblic($site_url);
  58. $img .= $site_url.'</a></div>';
  59.  
  60.  
  61. }
  62.  
  63.  
  64. }
  65.  
  66. return $img;
  67. }
  68.  
  69. function monbanner_rotate() {
  70. global $wpdb;
  71.  
  72. if (monchange( 'modul', 'banner' ) == 'true') {
  73. $wpdb->get_row;
  74. $wpdb->prefix;
  75. }
  76.  
  77. $banners = ( 'SELECT * FROM ' .$wpdb->prefix . 'postmeta LEFT OUTER JOIN ' . $wpdb->prefix . 'posts ON(' . $wpdb->prefix . 'postmeta.post_id = ' . $wpdb->prefix . 'posts.ID) WHERE post_status=\'publish\' AND meta_key=\'banner\' AND meta_value != \'\' ORDER BY RAND()' );
  78. $onebanner = $banners->meta_value;
  79.  
  80. if (10 < strlen( $onebanner )) {
  81. echo '<div id="monbanner_rotate">' . $onebanner . '</div>';
  82. }
  83.  
  84.  
  85. }
  86.  
  87. function mon_not_caps_name($name) {
  88. $name = esc_html( stripslashes( strip_tags( $name ) ) );
  89.  
  90. if ($name) {
  91. $newname = mb_strtoupper(mb_substr ($name,0,1 ) ) . mb_strtolower( mb_substr( $name, 1, mb_strlen( $name ) ) );
  92. return $newname;
  93. }
  94.  
  95.  
  96. }
  97.  
  98. function count_ptype_partner() {
  99. global $wpdb;
  100.  
  101. $ptype = mon_ptype( );
  102. $count = $wpdb->query( 'SELECT ID FROM ' . $wpdb->prefix . ( 'posts WHERE post_type=\'' . $ptype . '\' AND post_status=\'publish\'' ) );
  103. return $count;
  104. }
  105.  
  106. function monbo_shingle($text, $search) {
  107. $cont = explode( ' ', strip_tags( $text ) );
  108. foreach ($cont as $key => $con) {
  109.  
  110. while (true) {
  111. if (preg_match( '/(' . $search . ')/iu', $con )) {
  112. $on = $cont;
  113. break;
  114. }
  115. }
  116. }
  117.  
  118. $start = $on - 20;
  119.  
  120. if ($start < 0) {
  121. $start = 279;
  122. $end = $on + 21;
  123. $cc = count( $cont );
  124. }
  125.  
  126.  
  127. if ($cc < $end) {
  128. $end = $end;
  129. $content = '';
  130. }
  131.  
  132.  
  133. if ($start++ < $end) {
  134. if ($cont[$start]) {
  135. $content .= $cont[$start] . ' ';
  136. }
  137. }
  138.  
  139. jmp;
  140. return $content;
  141. }
  142.  
  143. function monbo_search_content($text, $search, $cifr = 42) {
  144. if (preg_match( '/(' . $search . ')/iu', $text )) {
  145. $content = monbo_shingle( $text, $search );
  146. jmp;
  147.  
  148. }
  149.  
  150. $content = wp_trim_words($text, $cifr );
  151. return preg_replace( '/(' . $search . ')/iu', '<span class="mon_searchvid">' . $search . '</span>', $content );
  152. }
  153.  
  154. function get_link_for_monitoring($post_id, $post = '') {
  155.  
  156. if ($post) {
  157. $link = get_post_meta( $post->ID, 'link', true );
  158. $link = get_post_meta( $post_id, 'link', true );
  159. if (!$link) {
  160. $link = 'ссылка';
  161. }
  162.  
  163. '<a href="' . the_part_link( $post_id ) . '" target="_blank">' . $link . '</a>';
  164. }
  165.  
  166. return ;
  167. }
  168.  
  169. function the_part_link($post_id) {
  170. return apply_filters( 'the_monbo_part_link', '/?sitelink=' . $post_id, $post_id );
  171. }
  172.  
  173. function mon_first_letter($arg) {
  174. mb_substr( $arg, 0, 1 );
  175. $llet = $flet = mb_substr( $arg, 1, mb_strlen( $arg ) );
  176. return '<span class="fletter">' . $flet . '</span>' . $llet;
  177. }
  178.  
  179. function mon_osntable($page, $category, $orderby, $order, $count, $title, $pagenavis, $ajax, $help, $dostup)
  180. {
  181. global $wpdb;
  182. $table = '';
  183.  
  184. if (!$title) {
  185. $title = monchange('htable', 'name');
  186. $count = intval($count);
  187. }
  188.  
  189. if (!$count) {
  190. $count = intval(monchange('htable', 'count'));
  191. }
  192. if (!$pagenavis) {
  193. $pagenavis = monchange('htable', 'pagenavi');
  194.  
  195. if ($pagenavis != 'true') {
  196. $pagenavis = 'false';
  197.  
  198. }
  199. }
  200.  
  201. if (!$ajax) {
  202. $ajax = monchange('htable', 'navi');
  203.  
  204. if ($ajax != 'true') {
  205. $ajax = 'post';
  206. }
  207. }
  208. // if ($ajax == 'ajax') {
  209. // $classed = 'monnaviajax';
  210. // $table .= '<div class="montable ' . $classed . '">';
  211. //
  212. // if ($title) {
  213. // $table .= '<div class="monosntabletitle">' . $title . '</div>';
  214. //
  215. //
  216. // }
  217. //
  218. // }
  219. if (isset($_GET['monorder']) ) {
  220. $orderby = $_GET['monorderby'];
  221. $order = $_GET['monorder'];
  222. }
  223.  
  224.  
  225.  
  226.  
  227.  
  228. $r = 0;
  229. foreach ($_GET as $smget => $val) {
  230. //$uri = preg_replace( '/[&?]{1}' . $smget . '[=]{1,3}' . $val . '/', '');
  231. $val = trim(esc_html(strip_tags($val)));
  232.  
  233. // if (( ( $smget != 'monpage' && $smget != 'monorderby' ) && $smget != 'monorder' )) {
  234. // ++$r;
  235. //
  236. // if ($r == 1) {
  237. // $uri .= '?' . $smget . '=' . $val;
  238. // $zn = '&';
  239. // break;
  240. // }
  241. //
  242. // break;
  243. // }
  244. //
  245. // break;
  246. }
  247.  
  248.  
  249. $tvoi = array();
  250. $tu = mon_your_id();
  251. $seles = $wpdb->get_results('SELECT * FROM ' . $wpdb->prefix . ('monsravni WHERE ryour=\'' . $tu . '\''));
  252. foreach ($seles as $sel) {
  253. $tvoi[] = $sel->ruch;
  254. }
  255.  
  256. $monstatus = array();
  257. $views = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "monstatus ");
  258. foreach ($views as $vi) {
  259. $monstatus[$vi->doppole][$vi->id] = $vi;
  260. }
  261.  
  262.  
  263. if ($ajax == 'ajax') {
  264. $ajaxinput = '
  265. <input type="hidden" name="" class="monajaxinput_page" value="' . $page . '" />
  266. <input type="hidden" name="" class="monajaxinput_category" value="' . $category . '" />
  267. <input type="hidden" name="" class="monajaxinput_orderby" value="' . $orderby . '" />
  268. <input type="hidden" name="" class="monajaxinput_order" value="' . $order . '" />
  269. <input type="hidden" name="" class="monajaxinput_count" value="' . $count . '" />
  270. <input type="hidden" name="" class="monajaxinput_title" value="' . $title . '" />
  271. <input type="hidden" name="" class="monajaxinput_pagenavi" value="' . $pagenavis . '" />
  272. <input type="hidden" name="" class="monajaxinput_ajax" value="' . $ajax . '" />
  273. <input type="hidden" name="" class="monajaxinput_help" value="' . $help . '" />
  274. <input type="hidden" name="" class="monajaxinput_dostup" value="' . $dostup . '" />
  275. ';
  276. }
  277. $table .= '<div class="monosntable">' . $ajaxinput . '<table><tr>';
  278. $poles = array();
  279. $views = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "doppole WHERE posnt = 1 ORDER BY posntsort ASC");
  280. foreach ($views as $vi) {
  281. $poles[$vi->id] = $vi;
  282. }
  283. $th = 0;
  284. foreach ($poles as $pol) {
  285. ++$th;
  286. $polevid = $pol->mtype;
  287.  
  288. if ($polevid == 101) {
  289. $monthclass = 'mot_title';
  290. $monorder = '&monorder=asc';
  291. if ($orderby == 'title') {
  292. if ($order == 'asc') {
  293. $monorder = '&monorder=desc';
  294. //$ajorder = 'jadesc';
  295. $monthclass .= ' asc';
  296. }
  297. if ($order == 'desc'){
  298. $monthclass .= ' desc';
  299. }
  300.  
  301. }
  302.  
  303.  
  304. $table .= '<th><a href="?monorderby=title' . $monorder . '" name="title" class=" ' . $monthclass . ' ">
  305. ' . $pol->mname . '</a></th>';
  306. } elseif ($polevid == 102) {
  307. $table .= '<th><div class="monosntableth mot_monpostmeta">' . $pol->mname . '</div></th>';
  308. } elseif ($polevid == 103) {
  309.  
  310. $table .= '<th><div class="monosntableth mot_monpostmeta">' . $pol->mname . '</div></th>';
  311.  
  312. } elseif ($polevid == 104) {
  313. $monthclass = 'mot_ranking';
  314. $monorder = '&monorder=asc';
  315. if($orderby == 'ranking'){
  316. if ($order == 'asc') {
  317. $monorder = '&monorder=desc';
  318. //$ajorder = 'jadesc';
  319. $monthclass .= ' jaasc asc';
  320. }
  321. if ($order == 'desc'){
  322. $monthclass .= ' desc';
  323. }
  324.  
  325. }
  326.  
  327. $table .= '<th><a href="?monorderby=ranking' . $monorder . '" name="ranking" class=" ' . $monthclass . ' ">
  328. ' . $pol->mname . '</a></th>';
  329. } elseif ($polevid == 105) {
  330.  
  331. $table .= '<th><div class="monosntableth mot_monpostmeta">' . $pol->mname . '</div></th>';
  332.  
  333. } elseif ($polevid == 106) {
  334.  
  335. $table .= '<th><div class="monosntableth mot_monpostmeta">' . $pol->mname . '</div></th>';
  336.  
  337. } elseif ($polevid == 107) {
  338.  
  339. $table .= '<th><div class="monosntableth mot_monpostmeta">' . $pol->mname . '</div></th>';
  340.  
  341. } elseif ($polevid == 109) {
  342. $table .= '<th><div class="monosntableth mot_monpostmeta">' . $pol->mname . '</div></th>';
  343. } elseif ($polevid == 110) { //логотип
  344.  
  345. $table .= '<th><div class="monosntableth mot_monpostmeta">' . $pol->mname . '</div></th>';
  346.  
  347. } elseif ($polevid == 111) { //логотип со ссылкой на внутреннюю
  348.  
  349. $table .= '<th><div class="monosntableth mot_monpostmeta">' . $pol->mname . '</div></th>';
  350.  
  351. } elseif ($polevid == 112) { //логотип со ссылкой на сайта участника
  352.  
  353. $table .= '<th><div class="monosntableth mot_monpostmeta">' . $pol->mname . '</div></th>';
  354.  
  355. } elseif ($polevid == 0) {
  356.  
  357. $table .= '<th><div class="monosntableth mot_monpostmeta">' . $pol->mname . '</div></th>';
  358.  
  359. } elseif ($polevid == 1) {
  360.  
  361. $table .= '<th><div class="monosntableth mot_monpostmeta">' . $pol->mname . '</div></th>';
  362.  
  363. } elseif ($polevid == 2) {
  364.  
  365. $table .= '<th><div class="monosntableth mot_monpostmeta">' . $pol->mname . '</div></th>';
  366.  
  367. } elseif ($polevid == 3) {
  368. $table .= '<th><div class="monosntableth mot_monpostmeta">' . $pol->mname . '</div></th>';
  369. } elseif ($polevid == 4) {
  370. $helprow = monchange('hstable', 'helprow');
  371. if(is_array($helprow)){
  372. foreach($helprow as $th){
  373. $ts = $th;
  374. }
  375. }
  376. $monthclass = ' mot_monpostmeta';
  377. $monorder = '&monorder=asc';
  378. if ($orderby == 'monpostmeta22') {
  379. if ($order == 'asc') {
  380. $monorder = '&monorder=desc';
  381. //$ajorder = 'jadesc';
  382. $monthclass .= ' asc';
  383. }
  384. if ($order == 'desc'){
  385. $monthclass .= ' desc';
  386. }
  387.  
  388. }
  389. $table .= '<th><a href="?monorderby=monpostmeta'.$ts . $monorder . '" name="monpostmeta22" class=" ' . $monthclass . ' ">
  390. ' . $pol->mname . '</div></th>';
  391. } elseif ($polevid == 5) {
  392.  
  393. $table .= '<th><div class="monosntableth mot_monpostmeta">' . $pol->mname . '</div></th>';
  394.  
  395. } elseif ($polevid == 6) {
  396.  
  397. $table .= '<th><div class="monosntableth mot_monpostmeta">' . $pol->mname . '</div></th>';
  398.  
  399. } elseif ($polevid == 7) {
  400.  
  401. $table .= '<th><div class="monosntableth mot_monpostmeta">' . $pol->mname . '</div></th>';
  402.  
  403. } elseif ($polevid == 8) {
  404.  
  405. $table .= '<th><div class="monosntableth mot_monpostmeta">' . $pol->mname . '</div></th>';
  406.  
  407. } elseif ($polevid == 9) {
  408.  
  409. $table .= '<th><div class="monosntableth mot_monpostmeta">' . $pol->mname . '</div></th>';
  410.  
  411. } elseif ($polevid == 10) {
  412.  
  413. $table .= '<th><div class="monosntableth mot_monpostmeta">' . $pol->mname . '</div></th>';
  414.  
  415. } elseif ($polevid == 11) {
  416.  
  417. $table .= '<th><div class="monosntableth mot_monpostmeta">' . $pol->mname . '</div></th>';
  418.  
  419. }
  420. }
  421.  
  422.  
  423. $s = 0;
  424. $table .= '</tr>';
  425. // $thetax = ()
  426. // $taxonomy = $thetax->taxonomy;
  427. // if ($taxonomy) {
  428. // $args = array( 'tax_query' => array( array(
  429. // 'taxonomy' => $taxonomy,
  430. // 'field' => 'id',
  431. // 'terms' => array( $category ) ) ),
  432. // 'order' => $order,
  433. // 'post_type' => $post_type,
  434. // 'posts_per_page' => '-1' );
  435. // }
  436. $term = $wpdb->get_row("SELECT * FROM ".$wpdb->prefix."doppole WHERE mtype IN ('2','3')");
  437. $term_name = $term->catname;
  438.  
  439. if($term_name) {
  440. // $res = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."monsravni ");
  441. // //$value = $wpdb->get_results("SELECT * FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON tt.term_id = t.term_id WHERE tt.taxonomy IN ('" .$term_name . "') ORDER BY t.name ASC");;
  442. // $doppoles = get_terms($term_name);
  443. // $ccc = has_category( $category );
  444. }
  445. $post_type = monchange('osn', 'slug');
  446. $args = array(
  447. 'post_type' => $post_type,
  448. 'posts_per_page' => $count,
  449. 'post_status' => 'publish',
  450. 'order' => $order,
  451. 'orderby' => $orderby,
  452. 'posts_per_page' => '-1',
  453. //'category' => $category,
  454. );
  455. $pars = get_posts($args);
  456. if ($orderby == 'ranking' AND $order == 'asc') {
  457. $i = 0;
  458. while ($i <= 5) {
  459. foreach ($pars as $rr) {
  460. $rr->ranking = get_post_meta($rr->ID, 'rating', true);
  461. if($rr->ranking == $i){
  462. $rrr[] = $rr;
  463. }
  464. }
  465.  
  466. $i++;
  467. }
  468. $pars = $rrr;
  469. }
  470. if ($orderby == 'ranking' AND $order == 'desc') {
  471. $i = 5;
  472. while ($i >= 0) {
  473. foreach ($pars as $rr) {
  474. $rr->ranking = get_post_meta($rr->ID, 'rating', true);
  475. if($rr->ranking == $i){
  476. $rrr[] = $rr;
  477. }
  478. }
  479.  
  480. $i--;
  481. }
  482. $pars = $rrr;
  483. }
  484. if( $orderby == 'monpostmeta'.$ts AND $order == 'desc') {
  485. $views = $monstatus[$ts];
  486. if (is_array($views)) {
  487. foreach ($views as $id) {
  488. foreach ($pars as $rr) {
  489. $rr->id_state = get_post_meta($rr->ID, 'monpostmeta'.$ts, true);;
  490. if($rr->id_state == $id->id){
  491. $rrr[] = $rr;
  492. }
  493. }
  494. }
  495.  
  496. }
  497. $pars = $rrr;
  498. }
  499.  
  500. if( $orderby == 'monpostmeta'.$ts AND $order == 'asc') {
  501. $views = $monstatus[$ts];
  502. if (is_array($views)) {
  503. arsort($views);
  504. foreach ($views as $id) {
  505. foreach ($pars as $rr) {
  506. $rr->id_state = get_post_meta($rr->ID, 'monpostmeta'.$ts, true);;
  507. if($rr->id_state == $id->id){
  508. $rrr[] = $rr;
  509. }
  510. }
  511. }
  512.  
  513. }
  514. $pars = $rrr;
  515. }
  516.  
  517. if($category != 0){
  518. foreach ($pars as $rr) {
  519. $terms = get_the_terms($rr->ID, 'mcat13');
  520. $mcat = array();
  521. if (is_array($terms)) {
  522. foreach ($terms as $ter) {
  523. if($category == $ter->term_id){
  524. $cater[] = $rr ;
  525. }
  526. }
  527.  
  528. }
  529. }
  530. $pars = $cater;
  531. }
  532.  
  533. foreach ($pars as $mp) {
  534.  
  535. ++$s;
  536. if ($r%2 == 0) {
  537. $cl = 'even';
  538. } else {
  539. $cl = 'odd';
  540. }
  541. $table .= '<tr class="' . $cl . '">';
  542. foreach ($poles as $pol) {
  543. $polevid = $pol->mtype;
  544. $post_id = $mp->ID;
  545. $txt1 = $pol->mpr1;
  546. $txt2 = $pol->mpr2;
  547. $txt3 = $pol->mpr3;
  548. $polid = $pol->id;
  549. //$polcat = $pol->catname;
  550. $meta = 'monpostmeta' . $polid;
  551.  
  552. if ($mp->videl == 'true') {
  553. $videl = 'videl';
  554. }
  555. $permalink = get_permalink($mp->ID);
  556. $post_karma = $mp->karma;
  557. if (!$post_karma) {
  558.  
  559.  
  560. if (0 < $post_karma) {
  561. $post_karma = '+' . $post_karma;
  562. $pkcl = 'karmaplus';
  563. }
  564. }
  565. $table .= '<td><div class="monosntabletd">';
  566. if ($polevid == 101) {
  567. $pimg = get_post_meta($post_id, 'logotype', true);
  568. $title = get_the_title($post_id);
  569. $table .= apply_filters('mon_dp_title', '', 'osn', $title, $post_id, $pimg);
  570. $table .= '</div></td>';
  571. } elseif ($polevid == 102) {
  572. $table .= apply_filters('mon_dp_sitelink', '', 'osn', $post_id);
  573. $table .= '</div></td>';
  574. } elseif ($polevid == 103) {
  575.  
  576. $table .= apply_filters('mon_dp_singlelink', '', 'osn', $post_id);
  577. $table .= '</div></td>';
  578. } elseif ($polevid == 104) {
  579.  
  580. $link = get_permalink($post_id);
  581. $post_rating = get_post_meta($post_id, 'rating', true);
  582. $nrat = ceil(75 / 5 * $post_rating);
  583. $table .= '<a href="' . $link . '?opt=otzivs" class="rating compare" title="' . $post_rating . ' из 5.00"><div class="ratingvn" style="width: ' . $nrat . 'px"></div></a>';
  584. $table .= '</div></td>';
  585. } elseif ($polevid == 105) {
  586.  
  587. $post_karma = get_post_meta($post_id, 'karma', true);
  588. if ($post_karma > 0) {
  589. $post_karma = '+' . $post_karma;
  590. $pkcl = 'karmaplus';
  591. } elseif ($post_karma < 0) {
  592. $pkcl = 'karmaminus';
  593. } else {
  594. $pkcl = 'karmanull';
  595. }
  596. $table .= '<div class="comparekarma ' . $pkcl . '">' . $post_karma . '</div>';
  597. $table .= '</div></td>';
  598. } elseif ($polevid == 106) {
  599.  
  600. $cot = get_post_meta($post_id, 'motziv', true);
  601. $table .= apply_filters('mon_dp_countotziv', '', 'osn', $cot, $post_id);
  602. $table .= '</div></td>';
  603. } elseif ($polevid == 107) {
  604.  
  605. $cot = get_post_meta($post_id, 'mcomment', true);
  606. $table .= apply_filters('mon_dp_countcomment', '', 'osn', $cot, $post_id);
  607. $table .= '</div></td>';
  608. } elseif ($polevid == 109) {
  609. $table .= '<div name="' . $post_id . '" class="tgsr-' . $post_id . ' gosravni"></div>';
  610. $table .= '</div></td>';
  611. } elseif ($polevid == 110) { //логотип
  612.  
  613. $pimg = get_post_meta($post_id, 'logotype', true);
  614. $table .= apply_filters('mon_dp_logotype', '', 'osn', $pimg, $post_id);
  615. $table .= '</div></td>';
  616. } elseif ($polevid == 111) { //логотип со ссылкой на внутреннюю
  617.  
  618. $pimg = get_post_meta($post_id, 'logotype', true);
  619. $table .= apply_filters('mon_dp_logotype_vnlink', '', 'osn', $pimg, $post_id);
  620. $table .= '</div></td>';
  621. } elseif ($polevid == 112) { //логотип со ссылкой на сайта участника
  622.  
  623. $pimg = get_post_meta($post_id, 'logotype', true);
  624. $table .= apply_filters('mon_dp_logotype_sitelink', '', 'osn', $pimg, $post_id);
  625. $table .= '</div></td>';
  626. } elseif ($polevid == 0) {
  627.  
  628. $text = get_post_meta($post_id, $meta, true);
  629. $table .= $text . '' . $txt1;
  630. $table .= '</div></td>';
  631. } elseif ($polevid == 1) {
  632.  
  633. $text = get_post_meta($post_id, $meta, true);
  634. $table .= apply_filters('comment_text', $text);
  635. $table .= '</div></td>';
  636. } elseif ($polevid == 2) {
  637.  
  638. $terms = get_the_terms($post_id, $pol->catname);
  639. $mcat = array();
  640. if (is_array($terms)) {
  641. foreach ($terms as $ter) {
  642. $mcat[] = $ter->name;
  643. }
  644. }
  645. $table .= join(', ', $mcat);
  646. $table .= '</div></td>';
  647. } elseif ($polevid == 3) {
  648. $terms = get_the_terms($post_id, $pol->catname);
  649. $mcat = array();
  650. if (is_array($terms)) {
  651. foreach ($terms as $ter) {
  652. $mcat[] = $ter->name;
  653. }
  654.  
  655. $table .= join(', ', $mcat);
  656.  
  657. $table .= '</div></td>';
  658. }
  659. } elseif ($polevid == 4) {
  660. $text = get_post_meta($post_id, $meta, true);
  661. $mystatus = $monstatus[$polid][$text];
  662. $table .= '<div class="comparestatus"><img src="' . $mystatus->mimg . '" title="' . $mystatus->mtitle . '" alt="" /></div>';
  663. $table .= '</div></td>';
  664. } elseif ($polevid == 5) {
  665.  
  666. $text = get_post_meta($post_id, $meta, true);
  667. $table .= $text[1] . '' . $txt1 . ' ' . $text[2] . '' . $txt2;
  668. $table .= '</div></td>';
  669. } elseif ($polevid == 6) {
  670.  
  671. $text = get_post_meta($post_id, $meta, true);
  672. $table .= $text[1] . '' . $txt1 . ' ' . $text[2] . '' . $txt2 . ' ' . $text[3] . '' . $txt3;
  673. $table .= '</div></td>';
  674. } elseif ($polevid == 7) {
  675.  
  676. $text = get_post_meta($post_id, $meta, true);
  677. $table .= '<div class="compareyear">' . $text . '</div>';
  678. $table .= '</div></td>';
  679. } elseif ($polevid == 8) {
  680.  
  681. $text = get_post_meta($post_id, $meta, true);
  682. if ($text) {
  683. $table .= '<div class="comparedate">' . date('d.m.Y', $text) . '</div>';
  684. }
  685. $table .= '</div></td>';
  686. } elseif ($polevid == 9) {
  687.  
  688. $text = get_post_meta($post_id, $meta, true);
  689. if ($text) {
  690. $table .= '<div class="comparedatetime">' . date('d.m.Y H:i', $text) . '</div>';
  691. }
  692. $table .= '</div></td>';
  693. } elseif ($polevid == 10) {
  694.  
  695. $text = get_post_meta($post_id, $meta, true);
  696. if ($text == 'true') {
  697. $da = 'Да';
  698. $cmcl = 'yes';
  699. } else {
  700. $da = 'Нет';
  701. $cmcl = 'no';
  702. }
  703. $table .= '<div class="compareyesno ' . $cmcl . '">' . $da . '</div>';
  704. $table .= '</div></td>';
  705. } elseif ($polevid == 11) {
  706.  
  707. $text = get_post_meta($post_id, $meta, true);
  708. $table .= $text . ' ' . $txt1;
  709. $table .= '</div></td>';
  710. }
  711.  
  712.  
  713. // if ($polevid == 1) {
  714. // $text = $mp->$meta;
  715. // $table .= apply_filters('comment_text', $text);
  716. // }
  717.  
  718.  
  719. // if (is_array($terms)) {
  720. // $mcat = array();
  721. // foreach ($terms as $ter) {
  722. // $mcat[] = $ter->name;
  723. // break;
  724. // }
  725. //
  726. // $table .= join(', ', $mcat);
  727. // jmp;
  728. //
  729. // if ($polevid == 3) {
  730. // $terms = get_the_terms($post_id, $polcat);
  731. //
  732. //
  733. // if (is_array($terms)) {
  734. // foreach ($terms as $ter) {
  735. // $mcat[] = $ter->name;
  736. // break;
  737. // }
  738. //
  739. // $table .= join(', ', $mcat);
  740. // jmp;
  741. //
  742. //
  743. // }
  744. //
  745. // $table .= $text[2] . '' . $txt2;
  746. // }
  747. // $table .= '</tr>';
  748. // }
  749.  
  750. // $table .= $text . ' ' . $txt1;
  751.  
  752.  
  753. }
  754. $table .= '</tr>';
  755.  
  756. }
  757.  
  758.  
  759. if ($s == 0) {
  760. $table .= '<tr><td colspan="' . $th . '"><center>Данных нет.</center></td></tr>';
  761. }
  762.  
  763. $table .= '</table></div>';
  764. //$help = monchange('hstable','help');
  765. if ($help != 'false') {
  766. $helprow = monchange('hstable', 'helprow');
  767. if (is_array($helprow)) {
  768. foreach ($helprow as $hr) {
  769. $table .= '<div class="monhelpinfo">';
  770.  
  771. $views = $monstatus[$hr];
  772. if (is_array($views)) {
  773. foreach ($views as $vi) {
  774. $im = $vi->mimg;
  775. if ($im) {
  776. $mcl = 'background: url(' . $im . ') no-repeat;';
  777. } else {
  778. $mcl = '';
  779. }
  780. $table .= '<div class="monhstatus" style="' . $mcl . '">- ' . $vi->mtitle . '</div>';
  781. }
  782. }
  783. $table .= '</div><div class="clear"></div>';
  784. }
  785. }
  786. $table .= '</div>';
  787. }
  788.  
  789.  
  790. return $table;
  791. }
  792.  
  793. function monselectpod($arg, $key) {
  794. if (is_array( $arg )) {
  795. foreach ($arg as $ar ) {
  796. $ar = (bool)$ar;
  797. }
  798. }
  799.  
  800. if (trim( $ar ) == $key) {
  801. return 'selected="selected"';
  802. return null;
  803. $arg = (bool)$arg;
  804.  
  805. if (trim( $arg ) == $key) {
  806. }
  807.  
  808. return 'selected="selected"';
  809. return null;
  810. }
  811. }
  812.  
  813. function methodpodb($ct, $method, $arg1 = '') {
  814. if ($method == 'get') {
  815. if ($arg1) {
  816. $_GET[$ct][$arg1];
  817. }
  818.  
  819.  
  820. if (is_array($_GET[$ct][$arg1] )) {
  821. foreach ($_GET[$ct][$arg1] as $cs) {
  822. return $cs;
  823. }
  824.  
  825. return null;
  826. return $_GET[$ct][$arg1];
  827. return $_GET[$ct];
  828.  
  829. if ($arg1) {
  830. }
  831. }
  832.  
  833.  
  834. if (is_array( $_POST[$ct][$arg1] )) {
  835. foreach ($_POST[$ct][$arg1] as $cs) {
  836. return $cs;
  837. }
  838.  
  839. return null;
  840. return $_POST[$ct][$arg1];
  841. $_POST;
  842. }
  843. }
  844.  
  845. return [$ct];
  846. }
  847.  
  848. function get_thepolevivod($activeleft, $dpolei, $nmet, $monstatus) {
  849. global $wpdb;
  850.  
  851. $table = '';
  852.  
  853. if (is_array( $activeleft )) {
  854. foreach ($activeleft as $key) {
  855. $mtype = $key->mtype;
  856. $dopid = $key->id;
  857.  
  858. if ($mtype == 2) {
  859. $ncategory = get_terms( $key->catname, 'hide_empty=0' );
  860.  
  861. while (( is_array( $ncategory ) && 0 < count( $ncategory ) )) {
  862. $table .= '
  863. <div class="onepolepodb">
  864. <div class="onepolepodbtitle">' . $key->mname . '</div>
  865. <select name="mt' . $dopid . '" class="onepolepodbselect">
  866. <option value="0">-----------</option>
  867. ';
  868. foreach ($ncategory as $nc) {
  869.  
  870. while (true) {
  871. $table .= '<option value="' . $nc->term_id . '" ' . monselectpod( methodpodb( 'mt' . $dopid, $nmet ), $nc->term_id ) . '>' . $nc->name . '</option>';
  872. }
  873. }
  874.  
  875. $table .= '</select>
  876. </div>
  877. ';
  878. }
  879. }
  880.  
  881. break;
  882. }
  883. }
  884. else {
  885. while (true) {
  886.  
  887. if ($txt) {
  888. $txt1 = '(' . $txt . ')';
  889. break;
  890. }
  891.  
  892. $table .= $txt . methodpodb( 'ot' ) . '" /> до <input type="text" class="onepolepodbinput" name="mt' . $dopid . '[do]" value="' . methodpodb( 'mt' . $dopid, $nmet, 'do' ) . '" /></div>
  893. </div>
  894. ';
  895. }
  896.  
  897.  
  898. if ($mtype == 104) {
  899. $table .= '
  900. <div class="onepolepodb">
  901. <div class="onepolepodbtitle">Рейтинг</div>
  902. <div>от <input type="text" class="onepolepodbinput" name="mt' . $dopid . '[ot]" value="' . methodpodb( 'mt' . $dopid, $nmet, 'ot' ) . '" /> до <input type="text" class="onepolepodbinput" name="mt' . $dopid . '[do]" value="' . methodpodb( 'mt' . $dopid, $nmet, 'do' ) . '" /></div>
  903. </div>
  904. ';
  905. }
  906.  
  907.  
  908. while (true) {
  909. jmp;
  910. $table .= '[ot]" value="' . methodpodb( 'mt' . $dopid, $nmet, 'ot' ) . '" /> до <input type="text" class="onepolepodbinput" name="mt' . $dopid . '[do]" value="' . methodpodb( 'mt' . $dopid, $nmet, 'do' ) . '" /></div>
  911. </div>
  912. ';
  913. }
  914.  
  915.  
  916. if ($mtype == 106) {
  917. }
  918. }
  919.  
  920.  
  921. while (true) {
  922. while (true) {
  923. $table .= '
  924. <div class="onepolepodb">
  925. <div class="onepolepodbtitle"><label><input type="checkbox" name="mt' . $dopid . '" ' . checked( 'mt' . $dopid, 1, false ) . ' value="1" /> с отзывами</label></div>
  926. </div>
  927. ';
  928. }
  929.  
  930.  
  931. if ($mtype == 107) {
  932. $table .= '
  933. <div class="onepolepodb">
  934. <div class="onepolepodbtitle"><label><input type="checkbox" name="mt' . $dopid . '" ' . checked( 'mt' . $dopid, 1, false ) . ' value="1" /> с комментариями</label></div>
  935. </div>
  936. ';
  937. break;
  938. }
  939. }
  940.  
  941. return $table;
  942. }
  943.  
  944. function get_mon_key($val) {
  945. if (is_array( $val )) {
  946. foreach ($val as $va) {
  947. get_mon_key( $va );
  948. ;
  949. }
  950. }
  951.  
  952. return;
  953. }
  954.  
  955. function mon_choicetable($method = '', $tableonly = '')
  956. {
  957. global $wpdb;
  958. if ($method != 'ajax') {
  959. $method = 'post';
  960. if ($tableonly != 'true') {
  961. $tableonly = 'false';
  962.  
  963.  
  964. $dpolei = array();
  965. $doppoles = $wpdb->get_results('SELECT * FROM ' . $wpdb->prefix . 'doppole WHERE mtype NOT IN(\'101\',\'102\',\'103\',\'108\',\'109\',\'110\',\'111\',\'112\',\'0\',\'1\',\'5\',\'6\',\'9\') ORDER BY id DESC');
  966. foreach ($doppoles as $dop) {
  967. $dpolei[$dop->id] = $dop;
  968. }
  969.  
  970.  
  971. if ($tableonly == 'false') {
  972. //$activeleft = $wpdb->get_results('SELECT * FROM ' . $wpdb->prefix . 'doppole WHERE podt1=\'1\' ORDER BY podt1sort ASC');
  973. //$activecenter = $wpdb->get_results('SELECT * FROM ' . $wpdb->prefix . 'doppole WHERE podt2=\'1\' ORDER BY podt2sort ASC');
  974. //$activeright = $wpdb->get_results('SELECT * FROM ' . $wpdb->prefix . 'doppole WHERE podt3=\'1\' ORDER BY podt3sort ASC');
  975. $monstatus = array();
  976. $views = $wpdb->get_results('SELECT * FROM ' . $wpdb->prefix . 'monstatus');
  977. foreach ($views as $vi) {
  978. $monstatus[$vi->doppole][$vi->id] = $vi;
  979. }
  980.  
  981.  
  982. if ($method == 'post') {
  983. $form = '<form action="" method="get">'; //форма для подобрать!
  984. $nmet = 'get';
  985. }
  986. }
  987. }
  988. }
  989.  
  990.  
  991. if ($tableonly == 'false') {
  992. $table .= '</div>';
  993. }
  994.  
  995.  
  996. }
  997.  
  998.  
  999. if (!defined( 'ABSPATH' )) {
  1000. exit( );
  1001. }
  1002.  
  1003.  
  1004. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement