| @@ -137,24 +137,8 @@ | ||
| 137 | 137 | else |
| 138 | 138 | return false; // no binds, don't check. |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | - // When MB PRO is configured to output CSS via file. | |
| 142 | - static function outputFileCSS() | |
| 143 | - { | |
| 144 | - $collection_id = intval($_GET['id']); | |
| 145 | - $doc_id = intval($_GET['doc']); | |
| 146 | - $collection = new collection($collection_id); | |
| 147 | - $css = $collection->getDisplayCSS($doc_id); | |
| 148 | - if ($css) | |
| 149 | - { | |
| 150 | - header( "Content-type: text/css; charset: UTF-8" ); | |
| 151 | - echo $css; | |
| 152 | - } | |
| 153 | - exit(); | |
| 154 | - | |
| 155 | - } | |
| 156 | - | |
| 157 | 141 | /* Try to find the current place we are at in the site ( front / blog / page etc ) .*/ |
| 158 | 142 | protected static function getCurrentHook() |
| 159 | 143 | { |
| 160 | 144 | $hook = ''; |
| @@ -175,25 +159,24 @@ | ||
| 175 | 159 | { |
| 176 | 160 | $hook = "display_archive"; |
| 177 | 161 | } |
| 178 | 162 | |
| 179 | - $post_types = \get_post_types( | |
| 180 | - array('public' => true, | |
| 181 | - '_builtin' => false, | |
| 182 | - ) | |
| 183 | - ); | |
| 163 | + $post_types = \get_post_types( | |
| 164 | + array('public' => true, | |
| 165 | + '_builtin' => false, | |
| 166 | + ) | |
| 167 | + ); | |
| 184 | 168 | |
| 185 | - $this_post_type = get_post_type( get_the_ID() ); | |
| 169 | + $this_post_type = get_post_type( get_the_ID() ); | |
| 186 | 170 | |
| 187 | - foreach($post_types as $post_type) // custom post type | |
| 171 | + foreach($post_types as $post_type) // custom post type | |
| 172 | + { | |
| 173 | + if ($post_type == $this_post_type) | |
| 188 | 174 | { |
| 189 | - if ($post_type == $this_post_type) | |
| 190 | - { | |
| 191 | - $hook = 'display_' . $this_post_type; | |
| 192 | - } | |
| 193 | - | |
| 175 | + $hook = 'display_' . $this_post_type; | |
| 194 | 176 | } |
| 195 | 177 | |
| 178 | + } | |
| 196 | 179 | |
| 197 | 180 | return $hook; |
| 198 | 181 | } |
| 199 | 182 | |
| @@ -282,25 +265,11 @@ | ||
| 282 | 265 | parse_str($form, $post_form); |
| 283 | 266 | |
| 284 | 267 | $collection_id = intval($post_form["collection_id"]); |
| 285 | 268 | |
| 286 | - $admin = MB()->getClass('admin'); | |
| 269 | + $admin = MB()->getClass('admin'); | |
| 287 | 270 | |
| 288 | 271 | |
| 289 | - if (! Install::isPro() && $collection_id == 0) | |
| 290 | - { | |
| 291 | - $collections = self::getCollections(); | |
| 292 | - if (count($collections) > 0) | |
| 293 | - { | |
| 294 | - $result = array( | |
| 295 | - "error" => true, | |
| 296 | - ); | |
| 297 | - $admin->endAjaxRequest($result); | |
| 298 | - } | |
| 299 | - } | |
| 300 | - | |
| 301 | - | |
| 302 | - | |
| 303 | 272 | $close_text = __('Close', 'maxbuttons'); |
| 304 | 273 | |
| 305 | 274 | $result = array( |
| 306 | 275 | "error" => false, |
| @@ -311,11 +280,15 @@ | ||
| 311 | 280 | "new_nonce" => 0, |
| 312 | 281 | "title" => __("Saved!","mbsocial"), |
| 313 | 282 | ); |
| 314 | 283 | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 315 | 287 | $collection = new collection(); |
| 316 | 288 | $collection->set($collection_id); |
| 317 | 289 | |
| 290 | + | |
| 318 | 291 | // this can be a new id (!) |
| 319 | 292 | $collection_id = $collection->save($post_form); |
| 320 | 293 | |
| 321 | 294 | $result["data"]["id"] = $collection_id; |
| @@ -325,35 +298,13 @@ | ||
| 325 | 298 | |
| 326 | 299 | // $result["title"] = $result_title["success"]; |
| 327 | 300 | |
| 328 | 301 | $admin->endAjaxRequest($result); |
| 302 | + | |
| 303 | + //echo json_encode($result); | |
| 304 | + //exit(); | |
| 329 | 305 | } |
| 330 | 306 | |
| 331 | - static function ajax_remove_collection() | |
| 332 | - { | |
| 333 | - $admin = MB()->getClass('admin'); | |
| 334 | - | |
| 335 | - $collection_id = intval($_POST['param']); | |
| 336 | - | |
| 337 | - $url = admin_url('?page=maxbuttons-social'); | |
| 338 | - | |
| 339 | - $result = array( | |
| 340 | - 'error' => false, | |
| 341 | - 'redirect' => $url, | |
| 342 | - ); | |
| 343 | - | |
| 344 | - global $wpdb; | |
| 345 | - | |
| 346 | - $table = maxUtils::get_collection_table_name(); | |
| 347 | - $where = array("collection_id" => $collection_id); | |
| 348 | - $where_format = array("%d"); | |
| 349 | - $wpdb->delete($table, $where, $where_format); | |
| 350 | - | |
| 351 | - | |
| 352 | - $admin->endAjaxRequest($result); | |
| 353 | - | |
| 354 | - } | |
| 355 | - | |
| 356 | 307 | static function ajax_action_front() |
| 357 | 308 | { |
| 358 | 309 | |
| 359 | 310 | // only for trivial front page actions! |
| @@ -569,16 +520,9 @@ | ||
| 569 | 520 | } |
| 570 | 521 | |
| 571 | 522 | $collection->saveData(); |
| 572 | 523 | |
| 573 | - $collection_id = $collection->getID(); | |
| 574 | - $url = admin_url('?page=maxbuttons-social'); | |
| 575 | - $url = add_query_arg('social_id', $collection_id, $url); | |
| 576 | - | |
| 577 | - echo json_encode( array( | |
| 578 | - 'done' => true, | |
| 579 | - 'redirect' => $url, | |
| 580 | - ) ); | |
| 524 | + echo json_encode( array('done' => true) ); | |
| 581 | 525 | exit(); |
| 582 | 526 | |
| 583 | 527 | } |
| 584 | 528 | |
| @@ -589,9 +533,9 @@ | ||
| 589 | 533 | global $wpdb; |
| 590 | 534 | |
| 591 | 535 | $table = maxUtils::get_collection_table_name(); |
| 592 | 536 | |
| 593 | - $sql = "SELECT distinct collection_id from $table WHERE collection_key = 'collection_type' and collection_value = 'social_share' order by collection_id "; | |
| 537 | + $sql = "SELECT distinct collection_id from $table WHERE collection_key = 'collection_type' and collection_value = 'social_share' "; | |
| 594 | 538 | |
| 595 | 539 | $results = $wpdb->get_col($sql); |
| 596 | 540 | return $results; |
| 597 | 541 | } |