Permalink
Browse files

Tagged version 2.2.8

git-svn-id: http://plugins.svn.wordpress.org/cleeng/trunk@476436 b8457f37-d9ea-0310-8a92-e5e31aec5664
  • Loading branch information...
0 parents commit 5a74ab8c2f261a3b451163d44d71d97d1466c843 mtymek committed Dec 16, 2011
Showing with 12,020 additions and 0 deletions.
  1. +261 −0 ajax-set-content.php
  2. +208 −0 ajax.php
  3. +1 −0 channel.html
  4. +44 −0 cleengWP.php
  5. +379 −0 css/cleengBEWidget.css
  6. +637 −0 css/cleengFEWidget.css
  7. BIN css/south-street/images/ui-anim_basic_16x16.gif
  8. BIN css/south-street/images/ui-bg_glass_55_fcf0ba_1x400.png
  9. BIN css/south-street/images/ui-bg_gloss-wave_100_ece8da_500x100.png
  10. BIN css/south-street/images/ui-bg_highlight-hard_100_f5f3e5_1x100.png
  11. BIN css/south-street/images/ui-bg_highlight-hard_100_fafaf4_1x100.png
  12. BIN css/south-street/images/ui-bg_highlight-hard_15_459e00_1x100.png
  13. BIN css/south-street/images/ui-bg_highlight-hard_95_cccccc_1x100.png
  14. BIN css/south-street/images/ui-bg_highlight-soft_25_67b021_1x100.png
  15. BIN css/south-street/images/ui-bg_highlight-soft_95_ffedad_1x100.png
  16. BIN css/south-street/images/ui-bg_inset-soft_15_2b2922_1x100.png
  17. BIN css/south-street/images/ui-icons_808080_256x240.png
  18. BIN css/south-street/images/ui-icons_847e71_256x240.png
  19. BIN css/south-street/images/ui-icons_8dc262_256x240.png
  20. BIN css/south-street/images/ui-icons_cd0a0a_256x240.png
  21. BIN css/south-street/images/ui-icons_eeeeee_256x240.png
  22. BIN css/south-street/images/ui-icons_ffffff_256x240.png
  23. +2,748 −0 css/south-street/jquery-ui-1.8.2.custom.css
  24. BIN img/ajax-loader.gif
  25. BIN img/arrow-bottom.png
  26. BIN img/arrow.png
  27. BIN img/banana-desc.png
  28. BIN img/banana.png
  29. BIN img/big_loader.gif
  30. BIN img/btn_xpressCheckout.gif
  31. BIN img/buy-button.png
  32. BIN img/cleeng-hands-money.png
  33. BIN img/cleeng-happy-world.png
  34. BIN img/cleeng-logo-small.png
  35. BIN img/cleeng-payment-methods.png
  36. BIN img/cleeng-share-commission.png
  37. BIN img/cleeng-small.png
  38. BIN img/cleeng-trans.png
  39. BIN img/cleeng-wp-editor1.png
  40. BIN img/cleeng-wp-editor2.png
  41. BIN img/cleeng-wp-setup-content.png
  42. BIN img/cleeng-wp-tags-editor.png
  43. BIN img/cleeng_reasons_timer.png
  44. BIN img/cleengit-small.png
  45. BIN img/cleengit.png
  46. BIN img/cleengit_disabled.png
  47. BIN img/clock.png
  48. BIN img/close.png
  49. BIN img/create-new-content.png
  50. BIN img/down.png
  51. BIN img/earth.png
  52. BIN img/editor.png
  53. BIN img/external.png
  54. BIN img/facebook.png
  55. BIN img/genius.png
  56. BIN img/hands.png
  57. BIN img/icons.png
  58. BIN img/item-types.png
  59. BIN img/layer_button_small.png
  60. BIN img/learn_about_features.png
  61. BIN img/loader.gif
  62. BIN img/lock.png
  63. BIN img/lock2.png
  64. BIN img/log-with-cleeng-a.png
  65. BIN img/log-with-cleeng-b.png
  66. BIN img/payment-methods-small.png
  67. BIN img/play-movie.png
  68. BIN img/plugin_bg.png
  69. BIN img/plugin_buy_button.png
  70. BIN img/plugin_buy_button_wide.png
  71. BIN img/plugin_grad_center.png
  72. BIN img/plugin_grad_sides.png
  73. BIN img/plugin_logo.png
  74. BIN img/price-bg-corner.png
  75. BIN img/register_with_cleeng.png
  76. BIN img/set-up-subscriptions.png
  77. BIN img/spacer.gif
  78. BIN img/star.png
  79. BIN img/stars.png
  80. BIN img/subscription_setup.png
  81. BIN img/tick.png
  82. BIN img/twitter.png
  83. BIN img/up.png
  84. +918 −0 js/CleengBEWidgetWP.js
  85. +509 −0 js/CleengFEWidgetWP.js
  86. +267 −0 js/ZeroClipboard.js
  87. BIN js/ZeroClipboard.swf
  88. +36 −0 js/functions.js
  89. +22 −0 js/jquery-ui-slider-1.7.3.js
  90. +10 −0 js/jquery.tmpl.min.js
  91. +14 −0 js/ui.datepicker.min-1.7.3.js
  92. +81 −0 js/ui.datepicker.min-1.8.10.js
  93. +14 −0 js/ui.datepicker.min.js
  94. +12 −0 js/ui.slider.min-1.7.3.js
  95. +33 −0 js/ui.slider.min-1.8.10.js
  96. +12 −0 js/ui.slider.min.js
  97. +1 −0 js/ui.timepicker.min.js
  98. BIN languages/cleeng-fr_FR.mo
  99. +856 −0 languages/cleeng-fr_FR.po
  100. BIN languages/cleeng-nl_NL.mo
  101. +751 −0 languages/cleeng-nl_NL.po
  102. BIN languages/cleeng-pl_PL.mo
  103. +236 −0 languages/cleeng-pl_PL.po
  104. +26 −0 license.txt
  105. +311 −0 php/classes/Admin.php
  106. +895 −0 php/classes/Client.php
  107. +143 −0 php/classes/Core.php
  108. +60 −0 php/classes/Dashboard.php
  109. +345 −0 php/classes/Editor.php
  110. +732 −0 php/classes/Frontend.php
  111. +119 −0 php/classes/Installer.php
  112. +133 −0 php/classes/Page/Quickstart.php
  113. +201 −0 php/classes/Page/Settings.php
  114. +133 −0 php/classes/Page/Sidebar.php
  115. +153 −0 php/classes/Page/WhatIsCleeng.php
  116. +28 −0 php/classes/Plugins.php
  117. +209 −0 php/classes/PostList.php
  118. +162 −0 php/classes/Rss.php
  119. +29 −0 php/classes/WpClient.php
  120. +291 −0 readme.txt
  121. BIN screenshot-1.jpeg
  122. BIN screenshot-2.jpeg
  123. BIN screenshot-3.jpeg
  124. BIN screenshot-4.jpeg
  125. BIN screenshot-5.jpeg
  126. BIN screenshot-6.jpeg
@@ -0,0 +1,261 @@
+<?php
+
+ob_start();
+define('WP_USE_THEMES', false);
+require('../../../wp-load.php');
+ob_end_clean();
+
+define('WP_ADMIN', true);
+if (!session_id()) {
+ session_start();
+}
+$admin = Cleeng_Core::load('Cleeng_Admin');
+
+global $wpdb;
+$table_name = $wpdb->prefix . "posts";
+
+$contentId = @$_REQUEST['contentId'];
+$contentIds = @$_REQUEST['contentIds'];
+$protection = @$_REQUEST['protection'];
+$cleeng = Cleeng_Core::load('Cleeng_WpClient');
+$default = $cleeng->getContentDefaultConditions();
+$user = $cleeng->getUserInfo();
+
+if (isset($contentIds) && $contentIds != null) {
+
+ $rows = $wpdb->get_results("SELECT * FROM " . $table_name . ' WHERE id IN (' . $contentIds . ')');
+
+ $cleengContentIds = array();
+ $i = 0;
+ $content = array();
+
+ foreach ($rows as $row) {
+ $contentId = $row->ID;
+ $postContent = $row->post_content;
+ $postTitle = $row->post_title;
+ switch ($protection) {
+ case 'remove-protection':
+ preg_match_all('/(\[cleeng_content.+\"\])/', $postContent, $matches);
+
+ if ($matches[1][0]) {
+
+ $postContent = str_replace($matches[1][0], ' ', $postContent);
+
+ preg_match('/id=\"([0-9]+)\"/', $matches[1][0], $matches);
+ $cleengContentId = $matches[1];
+
+ preg_match_all('/(\[\/cleeng_content\])/', $postContent, $matches);
+ $postContent = str_replace($matches[1][0], ' ', $postContent);
+
+ $cleengContentIds[] = $cleengContentId;
+
+ $wpdb->query(
+ "UPDATE $table_name
+ SET post_content = '$postContent'
+ WHERE id = $contentId
+ ");
+ }
+ break;
+ case 'add-protection':
+ preg_match_all('/(\[cleeng_content.+\"\])/', $postContent, $matches);
+
+ if (!isset($matches[1][0]) || $matches[1][0] == null) {
+ $content[$i]['shortDescription'] = substr($default['itemDescription'], 0, 100) . '...';
+ $content[$i]['price'] = $default['itemPrice'];
+ $content[$i]['itemType'] = 'article';
+ $content[$i]['url'] = get_permalink($contentId); // 'http://' . $_SERVER['HTTP_HOST'] . '?p=' . $contentId;
+
+ if ($default['referralProgram'] != 0) {
+ $content[$i]['referralRate'] = $default['referralProgram'] / 100;
+ $content[$i]['referralProgramEnabled'] = 1;
+ }
+ $content[$i]['pageTitle'] = $postTitle . ' | ' . get_bloginfo();
+ $content[$i]['externalId'] = $contentId;
+ }
+
+ default:
+ break;
+ }
+ $i++;
+ }
+
+ switch ($protection) {
+ case 'remove-protection':
+ $cleeng->removeContent($cleengContentIds);
+ break;
+ case 'add-protection':
+ if (!$default) {
+ $admin->session_error_message(__('You have to set up default content parameters in you Cleeng platform account.'));
+ exit;
+ }
+ $return = $cleeng->createContent($content);
+
+ foreach ($return as $row) {
+ if ($row['contentSaved'] === true) {
+ $contentId = $row['externalId'];
+ $wpRow = $wpdb->get_results("SELECT * FROM " . $table_name . ' WHERE id = ' . $contentId . '');
+ $postContent = $wpRow[0]->post_content;
+ $postTitle = $wpRow[0]->post_title;
+
+ $str1 = '[cleeng_content id="' . $row['contentId'] . '" description="' . $default['itemDescription'] . '" price="' . $default['itemPrice'].'"';
+ if ($default['referralProgram'] != 0) {
+ $str1 .= ' referral="' . '0.'.$default['referralProgram'] . '"';
+ }
+ $str1 .= ']';
+ $str2 = '[/cleeng_content]';
+ if (strpos($postContent, '<!--more-->')) {
+ preg_match('/\<\!\-\-more\-\-\>(.+)/', $postContent, $matches);
+ $postContent = str_replace($matches[1], '', $postContent);
+ $postContent = $postContent . $str1 . $matches[1] . $str2;
+
+ $wpdb->update($table_name, array('post_content' => $postContent), array('id' => $contentId));
+ } else {
+ $postContent = addProtection($postContent, $str1, $str2);
+ $wpdb->update($table_name, array('post_content' => $postContent), array('id' => $contentId));
+ }
+ }
+ }
+ break;
+ }
+} else {
+ $rows = $wpdb->get_results("SELECT * FROM " . $table_name . ' WHERE id = ' . $contentId . '');
+ $postContent = $rows[0]->post_content;
+ $postTitle = $rows[0]->post_title;
+
+ switch ($protection) {
+ case 'remove-protection':
+
+ preg_match_all('/(\[cleeng_content.+\"\])/', $postContent, $matches);
+
+ $postContent = str_replace($matches[1][0], ' ', $postContent);
+
+ preg_match('/id=\"([0-9]+)\"/', $matches[1][0], $matches);
+ $cleengContentId = $matches[1];
+
+ preg_match_all('/(\[\/cleeng_content\])/', $postContent, $matches);
+ $postContent = str_replace($matches[1][0], ' ', $postContent);
+
+ $contentInfo = $cleeng->getContentInfo(array($cleengContentId));
+
+ $r = $wpdb->update($table_name, array('post_content' => $postContent), array('id' => $contentId));
+
+ if ($contentInfo[$cleengContentId]["publisherId"] == $user['id'] && $cleeng->removeContent(array($cleengContentId))) {
+ $return = array(
+ 'protecting' => 'off'
+ );
+ header('content-type: application/json');
+ echo json_encode($return);
+ } else {
+ header('content-type: application/json');
+ if ($r==1) {
+ $return = array(
+ 'protecting' => 'off'
+ );
+ echo json_encode($return);
+ } else {
+ echo json_encode('error');
+ }
+ }
+ break;
+ case 'add-protection':
+
+ if (!$default) {
+ $admin->session_error_message(__('You have to set up default content parameters in you Cleeng platform account.'));
+ exit;
+ }
+ $default = $cleeng->getContentDefaultConditions();
+
+ $content = array();
+ $content['shortDescription'] = substr($default['itemDescription'], 0, 100) . '...';
+ $content['price'] = $default['itemPrice'];
+ $content['itemType'] = 'article';
+ $content['url'] = get_permalink($contentId); //'http://' . $_SERVER['HTTP_HOST'] . '?p=' . $contentId;
+
+ if ($default['referralProgram'] != 0) {
+ $content['referralRate'] = $default['referralProgram'] / 100;
+ $content['referralProgramEnabled'] = 1;
+ }
+ $content['pageTitle'] = $postTitle . ' | ' . get_bloginfo();
+ $content['externalId'] = $contentId;
+
+ $return = $cleeng->createContent(array($content));
+ if ($return[0]['contentSaved'] === true) {
+
+ $str1 = '[cleeng_content id="' . $return[0]['contentId'] . '" description="' . $default['itemDescription'] . '" price="' . $default['itemPrice'].'"';
+ if ($default['referralProgram'] != 0) {
+ $str1 .= ' referral="' . $content['referralRate'] . '"';
+ }
+ $str1 .= ']';
+ $str2 = '[/cleeng_content]';
+ if (strpos($postContent, '<!--more-->')) {
+ preg_match('/\<\!\-\-more\-\-\>(.+)/', $postContent, $matches);
+ $postContent = str_replace($matches[1], '', $postContent);
+ $postContent = $postContent . $str1 . $matches[1] . $str2;
+
+ $wpdb->update($table_name, array('post_content' => $postContent), array('id' => $contentId));
+
+ } else {
+
+ $postContent = addProtection($postContent, $str1, $str2);
+
+ $wpdb->update($table_name, array('post_content' => $postContent), array('id' => $contentId));
+ }
+ }
+
+ $content['symbol'] = $user['currencySymbol'];
+ $return = array(
+ 'protecting' => 'on',
+ 'info' => $content
+ );
+
+ header('content-type: application/json');
+ echo json_encode($return);
+
+ default:
+ break;
+ }
+}
+
+/**
+ * add protection after first paragraph
+ * @param string $postContent
+ * @param string $str1 cleeng first tag
+ * @param string $str2 cleeng last tag
+ * @return string $postContent
+ */
+function addProtection($postContent, $str1, $str2)
+{
+ if (strpos($postContent, '<!--more-->')) {
+ preg_match('/\<\!\-\-more\-\-\>(.+)/', $postContent, $matches);
+ $postContent = str_replace($matches[1], '', $postContent);
+ $postContent = $postContent . $str1 . $matches[1] . $str2;
+ } else {
+ $allblocks = '(?:table|div|dl|ul|form|p|h[1-6])';
+
+ preg_match('/(.*)(\n\s*?\n|\r\s*?\r|\r\n\s*?\r\n)(.*)/', $postContent, $matches);
+
+ preg_match('/(\n\s*?\n|\r\s*?\r|\r\n\s*?\r\n)(.*)/s', $postContent, $matches2);
+
+ if (isset($matches[2]) && isset($matches2[2]) && strlen(trim($matches2[2])) !=0 ) {
+
+ $postContentCleeng = str_replace($matches[1].$matches[2], $matches[1].$matches[2].$str1, $postContent).$str2;
+
+ preg_match('/(.*)\[cleeng_content.+\"\](.*)\[\/cleeng_content\]/s', $postContentCleeng, $matches);
+ $pccLength = strlen($matches[2]);
+ $pcLength = strlen($matches[1]);
+
+ preg_match_all('!(<' . $allblocks . '>)!', $matches[2], $openedTags);
+ preg_match_all('!(</' . $allblocks . '>)!', $matches[2], $closedTags);
+
+ if ( count($openedTags[1]) != count($closedTags[1]) || $pccLength < $pcLength){ //if cleeng content tags is odd protect all or if cleeng protected content is less than non-protected
+ $postContent = $str1.$postContent.$str2;
+ } else {
+ $postContent = $postContentCleeng;
+ }
+
+ } else {
+ $postContent = $str1.$postContent.$str2;
+ }
+ }
+ return $postContent;
+}
Oops, something went wrong.

0 comments on commit 5a74ab8

Please sign in to comment.