Webmaster Forum

Go Back   Webmaster Forum > Web Development > Coding Forum

Coding Forum Problems with your code? Discuss coding issues, including JavaScript, PHP & MySQL, HTML & CSS, Flash & ActionScript, and more.


Closed Thread
 
Thread Tools Display Modes
Share |
  #1  
Old 12-02-2015, 02:11 AM
Ord Allenbea Ord Allenbea is offline
Contributing Member
 
Join Date: 02-02-12
Location: Las Vegas
Posts: 3,239
iTrader: 0 / 0%
Code stop working can you help?

I have a small program that does several things but 1 thing is it identifies stop words. Ever since I have upgraded to php 5.4 the program stop working. Can anyone see any problems with this code and/or help correct it ?

The program when run stops at "Preparing" and it just flashes preparing over and over and does not do the output.

Code:
var last_results = 0; var last_keywords = 0; function DocResults(data) { document.getElementById("article_editor_path_row").innerHTML = "<span>Preparing.</span>"; data = JSON.parse(data); if(data.error != '') { document.getElementById("article_editor_path_row").innerHTML = "<span>"+data.error+"</span>"; return; } tinyMCE.get('article_editor').setContent(data.article, {format: 'html'}); var output = []; // Setup results. for(var i=0; i<data.results.length; i++) { output[i] = '<span>'+ Math.round(data.results[i] * 100) / 100; if(i == 11) { output[i] += '%'; } output[i] += '</span>'; } // Compare last results with the new results. if(last_results == 0) { $('#results').attr('style', ''); } else { var diff=0; for(var i=0; i<data.results.length; i++) { diff = Math.round((data.results[i] - last_results[i]) * 100) / 100; if(diff > 0) { output[i] += ' <span class="r_up">' + '+' + diff; } else if(diff < 0) { output[i] += ' <span class="r_down">' + diff; } if(diff != 0 && i == 11) { output[i] += '%'; } output[i] += '</span>'; } } last_results = JSON.parse(JSON.stringify(data.results)); $('#results table td:nth-of-type(2)').each(function(idx) { if(idx < data.results.length) { $(this).html( output[idx] ); } }); // Keywords var $keycon = $('#results table tbody:nth-of-type(3)'); $keycon.empty().append('<tr> <th>Keywords</th> <th>Count (<abbr title="Density refers to percentage of keywords within the overall document versus all words.">Density</abbr>)</th> </tr>'); output = []; var i=0; for(x in data.keywords) { var wordcount = x.split(' ').length; var p = Math.round((data.keywords[x] * wordcount / data.results[9]) * 10000) / 100; output[i++] = '<span>'+data.keywords[x]+' ('+p+'%)</span>'; } if(last_keywords != 0) { i=0; for(x in data.keywords) { if(last_keywords[x]) { var diff = data.keywords[x] - last_keywords[x]; if(diff > 0) { output[i] += ' <span class="r_up">' + '+' + diff; } else if(diff < 0) { output[i] += ' <span class="r_down">' + diff; } output[i] += '</span>'; } i++; } } i=0; for(x in data.keywords) { $keycon.append('<tr> <td>'+x+'</td> <td>'+output[i++]+'</td> </tr>'); } last_keywords = JSON.parse(JSON.stringify(data.keywords)); document.getElementById("article_editor_path_row").innerHTML = "<span>Done.</span>"; } tinymce.create('tinymce.plugins.EditorialScanner', { createControl: function(n, cm) { switch (n) { case 'catlist': var mlb = cm.createListBox('catlist', { title : 'Category', onselect : function(v) { //tinyMCE.activeEditor.windowManager.alert('Value selected:' + v); } }); mlb.add('Medical', 12); return mlb; case 'doc_analyze': var c = cm.createButton('doc_analyze', { title : 'Analyze', image : 'jscripts/go.png', onclick : function() { var article_text = '<html><body>'+tinyMCE.activeEditor.getContent({format: 'html', source_view: true})+'</body></html>'; document.getElementById("article_editor_path_row").innerHTML = "<span>Loading ...</span>"; AJAX('ajax/ajx_ediscan.php', 'article_text='+encodeURIComponent(article_text), DocResults); } }); return c; } return null; } }); tinymce.PluginManager.add('ediscan', tinymce.plugins.EditorialScanner); tinyMCE.init({ plugins : '-ediscan', mode : "exact", elements : "article_editor", auto_focus : "article_editor", content_css : "jscripts/mce.css", theme : "advanced", skin : "o2k7", keep_styles : false, forced_root_block : false, force_br_newlines : true, force_p_newlines : false, theme_advanced_buttons1 : "doc_analyze,|,undo,redo,|,code,", theme_advanced_buttons2 : "", theme_advanced_buttons3 : "", theme_advanced_toolbar_location : "top", theme_advanced_toolbar_align : "left", theme_advanced_resizing : true, theme_advanced_resize_horizontal : false, theme_advanced_statusbar_location : "bottom", theme_advanced_path : false, setup : function(ed) { ed.onGetContent.add(function(ed, o) { if(o.get == true && o.source_view == true) { var $html = $('<div>'+o.content+'</div>'); $('span.hl', $html).replaceWith( function() { return $(this).contents(); } ); o.content = $html.html(); } }); } });
 

Advertisement

Advertisement

  #2  
Old 12-02-2015, 05:33 AM
ScriptMan's Avatar
ScriptMan ScriptMan is online now
Super Moderator
 
Join Date: 02-10-07
Location: Central Kentucky
Posts: 14,018
iTrader: 4 / 100%
At first glance, no.

I recall enough problems on localhost that I dreaded the upgrade on live sites.

5.4 killed a bit of stuff we all used. I can not recall all of them. You might read this over:

http://php.net/manual/en/migration54.incompatible.php
 
  #3  
Old 12-03-2015, 03:03 PM
Ord Allenbea Ord Allenbea is offline
Contributing Member
 
Join Date: 02-02-12
Location: Las Vegas
Posts: 3,239
iTrader: 0 / 0%
Appreciate the help ill look into it. I know it's probably something in php or js that they got rid of or changed and the code just needs updated.
 
  #4  
Old 12-03-2015, 03:34 PM
ScriptMan's Avatar
ScriptMan ScriptMan is online now
Super Moderator
 
Join Date: 02-10-07
Location: Central Kentucky
Posts: 14,018
iTrader: 4 / 100%
Fairly sure it is PHP related. Some things were done away with in 5.4. Others were by default turned off in in the php.ini file. If you are lucky you will find it is the latter and deleting the # will solve your problem.
 
  #5  
Old 12-17-2015, 09:59 PM
Ord Allenbea Ord Allenbea is offline
Contributing Member
 
Join Date: 02-02-12
Location: Las Vegas
Posts: 3,239
iTrader: 0 / 0%
Got it fixed ScriptMan - it was actually a few lines of JS that needed updated.
 
Go Back   Webmaster Forum > Web Development > Coding Forum

Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Flash code working in IE but not chrome? chuckles Coding Forum 1 10-17-2011 01:04 AM
Javascript code not working. macintoshhelpers.com Coding Forum 6 08-31-2011 08:08 PM
Rich Snippet code not working. juliensimon Google Forum 4 05-19-2011 08:53 AM
My code, just isn't working. Arenlor Coding Forum 2 04-09-2007 11:53 PM
Anybody know why this PHP code isn't working edbarton Coding Forum 18 02-22-2004 12:20 PM


V7N Network
Get exposure! V7N I Love Photography V7N SEO Blog V7N Directory


All times are GMT -7. The time now is 03:38 PM.
Powered by vBulletin
Copyright 2000-2014 Jelsoft Enterprises Limited.
Copyright © 2003 - 2018 VIX-WomensForum LLC